@@ -601,20 +601,14 @@ test('checking different types and mutating multiple deep values', function (t)
601
601
// Inner arrays
602
602
// Inner arrays
603
603
604
- test ( 'changing length of array' , function ( t ) {
605
- const target = { objarr : [ 0 , 1 ] }
606
- const patch = { objarr : { length : 4 } }
607
- const expected = { objarr : [ 0 , 1 , undefined , undefined ] }
608
-
609
- testPatchUnpatch ( t , target , patch , expected )
610
- } )
611
-
612
604
test ( 'adding item to array ' , function ( t ) {
613
605
const target = { objarr : [ 0 , 1 ] }
614
606
const patch = { objarr : { 3 : { hello : 'world' } } }
615
607
const expected = { objarr : [ 0 , 1 , undefined , { hello : 'world' } ] }
616
608
617
- testPatchUnpatch ( t , target , patch , expected )
609
+ const { mutations } = testPatchUnpatch ( t , target , patch , expected )
610
+ t . is ( mutations . length , 2 )
611
+ t . is ( mutations [ 1 ] . prop , 'length' )
618
612
} )
619
613
620
614
test ( 'adding multiple item to array ' , function ( t ) {
@@ -625,6 +619,14 @@ test('adding multiple item to array ', function (t) {
625
619
testPatchUnpatch ( t , target , patch , expected )
626
620
} )
627
621
622
+ test ( 'changing length of array' , function ( t ) {
623
+ const target = { objarr : [ 0 , 1 ] }
624
+ const patch = { objarr : { length : 4 } }
625
+ const expected = { objarr : [ 0 , 1 , undefined , undefined ] }
626
+
627
+ testPatchUnpatch ( t , target , patch , expected )
628
+ } )
629
+
628
630
test ( 'editing length of array and also adding extra values' , function ( t ) {
629
631
const target = { objarr : [ 0 , 1 ] }
630
632
const patch = { objarr : { 3 : 3 , length : 5 } }
0 commit comments