@@ -601,20 +601,14 @@ test('checking different types and mutating multiple deep values', function (t)
601601// Inner arrays
602602// Inner arrays
603603
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-
612604test ( 'adding item to array ' , function ( t ) {
613605 const target = { objarr : [ 0 , 1 ] }
614606 const patch = { objarr : { 3 : { hello : 'world' } } }
615607 const expected = { objarr : [ 0 , 1 , undefined , { hello : 'world' } ] }
616608
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' )
618612} )
619613
620614test ( 'adding multiple item to array ' , function ( t ) {
@@ -625,6 +619,14 @@ test('adding multiple item to array ', function (t) {
625619 testPatchUnpatch ( t , target , patch , expected )
626620} )
627621
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+
628630test ( 'editing length of array and also adding extra values' , function ( t ) {
629631 const target = { objarr : [ 0 , 1 ] }
630632 const patch = { objarr : { 3 : 3 , length : 5 } }
0 commit comments