import { getSnapshot , applySnapshot , unprotect , types } from "../../src" ; test ( "it should avoid processing patch if is exactly the current one in applySnapshot" , ( ) => { const Model = types . model ( { a : types . number , b : types . string } ) ; const store = Model . create ( { a : 1 , b : "hello" } ) ; const snapshot = getSnapshot ( store ) ; applySnapshot ( store , snapshot ) ; expect ( getSnapshot ( store ) ) . toBe ( snapshot ) ; } ) ; test ( "it should avoid processing patch if is exactly the current one in reconcile" , ( ) => { const Model = types . model ( { a : types . number , b : types . string } ) ; const RootModel = types . model ( { a : Model } ) ; const store = RootModel . create ( { a : { a : 1 , b : "hello" } } ) ; unprotect ( store ) ; const snapshot = getSnapshot ( store ) ; expect ( getSnapshot ( store ) ) . toEqual ( snapshot ) ; store . a = snapshot . a ; expect ( getSnapshot ( store ) ) . toEqual ( snapshot ) ; expect ( getSnapshot ( store . a ) ) . toEqual ( snapshot . a ) ; const actualSnapshot = getSnapshot ( store ) ; expect ( actualSnapshot . a ) . toBe ( snapshot . a ) ; } ) ;