import { strict as assert } from "assert" ; import { MockFluidDataStoreRuntime } from "@fluidframework/test-runtime-utils" ; import { SharedMatrix , SharedMatrixFactory } from "@fluidframework/matrix" ; import { UndoRedoStackManager } from "../undoRedoStackManager" ; describe ( "Matrix" , ( ) => { let dataStoreRuntime ; let matrix ; let undo ; beforeEach ( async ( ) => { dataStoreRuntime = new MockFluidDataStoreRuntime ( ) ; matrix = new SharedMatrix ( dataStoreRuntime , "matrix1" , SharedMatrixFactory . Attributes ) ; undo = new UndoRedoStackManager ( ) ; matrix . openUndo ( undo ) ; } ) ; it ( "is compatible with UndoRedoStackManager" , ( ) => { matrix . insertRows ( 0 , 1 ) ; matrix . insertCols ( 0 , 1 ) ; undo . closeCurrentOperation ( ) ; matrix . setCell ( 0 , 0 , 1 ) ; assert . equal ( matrix . getCell ( 0 , 0 ) , 1 ) ; undo . undoOperation ( ) ; assert . equal ( matrix . getCell ( 0 , 0 ) , undefined ) ; undo . redoOperation ( ) ; assert . equal ( matrix . getCell ( 0 , 0 ) , 1 ) ; } ) ; } ) ;