@@ -44,7 +44,7 @@ describe('TrackStateAccessTree', () => {
4444
4545 mutationTree . state . foo = 'bar2'
4646
47- tree . flush ( )
47+ mutationTree . flush ( )
4848 expect ( reactionCount ) . toBe ( 1 )
4949 } )
5050 test ( 'should allow tracking by mutation' , ( ) => {
@@ -141,7 +141,7 @@ describe('OBJECTS', () => {
141141 const tree = new ProxyStateTree ( state )
142142 const mutationTree = tree . getMutationTree ( )
143143 mutationTree . state . foo = 'bar2'
144- expect ( ( tree as any ) . mutations ) . toEqual ( [
144+ expect ( mutationTree . mutations ) . toEqual ( [
145145 {
146146 method : 'set' ,
147147 path : 'foo' ,
@@ -159,7 +159,7 @@ describe('OBJECTS', () => {
159159
160160 delete mutationTree . state . foo
161161
162- expect ( ( tree as any ) . mutations ) . toEqual ( [
162+ expect ( mutationTree . mutations ) . toEqual ( [
163163 {
164164 method : 'unset' ,
165165 path : 'foo' ,
@@ -280,16 +280,16 @@ describe('ARRAYS', () => {
280280 title : 'foo' ,
281281 } )
282282 const currentProxy = mutationTree . state . items [ 0 ]
283- tree . flush ( )
283+ mutationTree . flush ( )
284284
285285 mutationTree . state . items . unshift ( {
286286 title : 'bar' ,
287287 } )
288288
289- tree . flush ( )
289+ mutationTree . flush ( )
290290 mutationTree . state . items [ 1 ] . title = 'wapah'
291291 const newProxy = mutationTree . state . items [ 1 ]
292- tree . flush ( )
292+ mutationTree . flush ( )
293293 expect ( currentProxy ) . not . toBe ( newProxy )
294294 } )
295295
@@ -338,7 +338,7 @@ describe('ARRAYS', () => {
338338 const tree = new ProxyStateTree ( state )
339339 const mutationTree = tree . getMutationTree ( )
340340 mutationTree . state . foo . push ( 'bar' )
341- expect ( tree . mutations ) . toEqual ( [
341+ expect ( mutationTree . mutations ) . toEqual ( [
342342 {
343343 method : 'push' ,
344344 path : 'foo' ,
@@ -356,7 +356,7 @@ describe('ARRAYS', () => {
356356 const tree = new ProxyStateTree ( state )
357357 const mutationTree = tree . getMutationTree ( )
358358 mutationTree . state . foo . pop ( )
359- expect ( tree . mutations ) . toEqual ( [
359+ expect ( mutationTree . mutations ) . toEqual ( [
360360 {
361361 method : 'pop' ,
362362 path : 'foo' ,
@@ -375,7 +375,7 @@ describe('ARRAYS', () => {
375375 const mutationTree = tree . getMutationTree ( )
376376 mutationTree . state . foo . shift ( )
377377
378- expect ( tree . mutations ) . toEqual ( [
378+ expect ( mutationTree . mutations ) . toEqual ( [
379379 {
380380 method : 'shift' ,
381381 path : 'foo' ,
@@ -393,7 +393,7 @@ describe('ARRAYS', () => {
393393 const mutationTree = tree . getMutationTree ( )
394394 mutationTree . state . foo . unshift ( 'foo' )
395395
396- expect ( tree . mutations ) . toEqual ( [
396+ expect ( mutationTree . mutations ) . toEqual ( [
397397 {
398398 method : 'unshift' ,
399399 path : 'foo' ,
@@ -411,7 +411,7 @@ describe('ARRAYS', () => {
411411 const mutationTree = tree . getMutationTree ( )
412412 mutationTree . state . foo . splice ( 0 , 1 , 'bar' )
413413
414- expect ( tree . mutations ) . toEqual ( [
414+ expect ( mutationTree . mutations ) . toEqual ( [
415415 {
416416 method : 'splice' ,
417417 path : 'foo' ,
@@ -431,7 +431,7 @@ describe('ARRAYS', () => {
431431 const mutationTree = tree . getMutationTree ( )
432432 mutationTree . state . foo = mutationTree . state . foo . concat ( 'bar' )
433433
434- expect ( tree . mutations ) . toEqual ( [
434+ expect ( mutationTree . mutations ) . toEqual ( [
435435 {
436436 method : 'set' ,
437437 path : 'foo' ,
@@ -527,7 +527,7 @@ describe('FUNCTIONS', () => {
527527 mutationTree . state . items . push ( {
528528 title : 'bar' ,
529529 } )
530- tree . flush ( )
530+ mutationTree . flush ( )
531531 expect ( reactionCount ) . toBe ( 1 )
532532 } )
533533} )
@@ -549,7 +549,7 @@ describe('REACTIONS', () => {
549549 accessTree . state . foo // eslint-disable-line
550550
551551 mutationTree . state . foo = 'bar2'
552- tree . flush ( )
552+ mutationTree . flush ( )
553553 expect ( reactionCount ) . toBe ( 1 )
554554 } )
555555
@@ -569,7 +569,7 @@ describe('REACTIONS', () => {
569569 } )
570570
571571 mutationTree . state . foo = 'bar2'
572- tree . flush ( )
572+ mutationTree . flush ( )
573573 } )
574574
575575 test ( 'should be able to manually add a path to the current tracking' , ( ) => {
@@ -586,7 +586,7 @@ describe('REACTIONS', () => {
586586 const accessTree = tree . getTrackStateTree ( ) . track ( render )
587587 accessTree . addTrackingPath ( 'foo' )
588588 mutationTree . state . foo = 'bar2'
589- tree . flush ( )
589+ mutationTree . flush ( )
590590 expect ( renderCount ) . toBe ( 1 )
591591 } )
592592
@@ -607,7 +607,7 @@ describe('REACTIONS', () => {
607607 mutationTree . state . foo = 'bar2'
608608 mutationTree . state . bar = 'baz2'
609609
610- tree . flush ( )
610+ mutationTree . flush ( )
611611 expect ( reactionCount ) . toBe ( 1 )
612612 } )
613613
@@ -617,7 +617,7 @@ describe('REACTIONS', () => {
617617 bar : 'baz' ,
618618 } )
619619 const accessTree = tree . getTrackStateTree ( ) . track ( render )
620- const mutationtree = tree . getMutationTree ( )
620+ const mutationTree = tree . getMutationTree ( )
621621 function render ( ) {
622622 if ( accessTree . state . foo === 'bar' ) {
623623 return
@@ -627,8 +627,8 @@ describe('REACTIONS', () => {
627627 }
628628
629629 render ( )
630- mutationtree . state . foo = 'bar2'
631- tree . flush ( )
630+ mutationTree . state . foo = 'bar2'
631+ mutationTree . flush ( )
632632 expect ( ( tree . pathDependencies as any ) . foo . size ) . toBe ( 1 )
633633 expect ( ( tree . pathDependencies as any ) . bar . size ) . toBe ( 1 )
634634 } )
@@ -649,11 +649,10 @@ describe('REACTIONS', () => {
649649
650650 render ( )
651651 mutationTree . state . foo = 'bar2'
652- tree . flush ( )
652+ mutationTree . flush ( )
653653 tree . disposeTree ( accessTree )
654654 expect ( tree . pathDependencies ) . toEqual ( { } )
655655 } )
656-
657656 test ( 'should allow subsequent mutation tracking and return all on flush' , ( ) => {
658657 const tree = new ProxyStateTree ( {
659658 foo : 'bar' ,
@@ -663,7 +662,7 @@ describe('REACTIONS', () => {
663662 mutationTree . state . foo = 'bar2'
664663 mutationTree2 . state . foo = 'bar3'
665664
666- const flushResult = tree . flush ( )
665+ const flushResult = tree . flush ( [ mutationTree , mutationTree2 ] )
667666 expect ( flushResult ) . toEqual ( {
668667 flushId : 0 ,
669668 mutations : [
@@ -748,11 +747,11 @@ describe('ITERATIONS', () => {
748747
749748 update ( )
750749 mutationTree . state . items . foo = 'bar'
751- tree . flush ( )
750+ mutationTree . flush ( )
752751 mutationTree . state . items . bar = 'baz'
753- tree . flush ( )
752+ mutationTree . flush ( )
754753 delete mutationTree . state . items . foo
755- tree . flush ( )
754+ mutationTree . flush ( )
756755 } )
757756
758757 test ( 'should react to array mutation methods' , ( ) => {
@@ -780,7 +779,7 @@ describe('ITERATIONS', () => {
780779 mutationTree . state . items . push ( {
781780 title : 'mip' ,
782781 } )
783- tree . flush ( )
782+ mutationTree . flush ( )
784783 expect ( reactionCount ) . toBe ( 1 )
785784 } )
786785
@@ -806,7 +805,7 @@ describe('ITERATIONS', () => {
806805 new Set ( [ 'items' , 'items.0' , 'items.0.title' , 'items.1' , 'items.1.title' ] )
807806 )
808807 mutationTree . state . items [ 0 ] . title = 'baz'
809- tree . flush ( )
808+ mutationTree . flush ( )
810809 expect ( reactionCount ) . toBe ( 1 )
811810 } )
812811
@@ -825,7 +824,7 @@ describe('ITERATIONS', () => {
825824 new Set ( [ 'items' , 'items.0' , 'items.1' ] )
826825 )
827826 mutationTree . state . items [ 0 ] = 99
828- tree . flush ( )
827+ mutationTree . flush ( )
829828 expect ( reactionCount ) . toBe ( 1 )
830829 } )
831830} )
@@ -855,7 +854,7 @@ describe('PRODUCTION', () => {
855854 mutationTree . state . items [ 0 ] . title = 'foo1'
856855 delete mutationTree . state . items [ 0 ] . title
857856 mutationTree . state . items [ 1 ] . title = 'bar2' // this mutation should not be tracked
858- expect ( tree . mutations ) . toEqual ( [
857+ expect ( mutationTree . mutations ) . toEqual ( [
859858 {
860859 method : 'set' ,
861860 path : 'items.0.title' ,
@@ -913,7 +912,7 @@ describe('GETTER', () => {
913912 render ( )
914913
915914 mutationTree . state . user . firstName = 'Bob2'
916- tree . flush ( )
915+ mutationTree . flush ( )
917916 expect ( renderCount ) . toBe ( 2 )
918917 } )
919918} )
0 commit comments