@@ -128,7 +128,7 @@ test('14 / https://tools.ietf.org/html/rfc7386 ', function (t) {
128128 const patch = { a : 'b' , c : TYPE . Delete ( ) }
129129 const expected = { a : 'b' }
130130
131- testPatchUnpatch ( t , target , patch , expected )
131+ testPatchUnpatch ( t , target , patch , expected , false )
132132} )
133133
134134test ( '15 / https://tools.ietf.org/html/rfc7386 ' , function ( t ) {
@@ -392,7 +392,7 @@ test('from object to array', function (t) {
392392 const patch = { objarr : [ 0 , 1 ] }
393393 const expected = { objarr : [ 0 , 1 ] }
394394
395- testPatchUnpatch ( t , target , patch , expected )
395+ const { unpatch } = testPatchUnpatch ( t , target , patch , expected )
396396} )
397397
398398test ( 'from array to object' , function ( t ) {
@@ -403,38 +403,6 @@ test('from array to object', function (t) {
403403 testPatchUnpatch ( t , target , patch , expected )
404404} )
405405
406- test ( 'changing length of array' , function ( t ) {
407- const target = { objarr : [ 0 , 1 ] }
408- const patch = { objarr : { length : 4 } }
409- const expected = { objarr : [ 0 , 1 , undefined , undefined ] }
410-
411- testPatchUnpatch ( t , target , patch , expected )
412- } )
413-
414- test ( 'adding item to array ' , function ( t ) {
415- const target = { objarr : [ 0 , 1 ] }
416- const patch = { objarr : { 3 : { hello : 'world' } } }
417- const expected = { objarr : [ 0 , 1 , undefined , { hello : 'world' } ] }
418-
419- testPatchUnpatch ( t , target , patch , expected )
420- } )
421-
422- test ( 'adding multiple item to array ' , function ( t ) {
423- const target = { objarr : [ 0 , 1 ] }
424- const patch = { objarr : { 3 : 3 , 5 : 5 } }
425- const expected = { objarr : [ 0 , 1 , undefined , 3 , undefined , 5 ] }
426-
427- testPatchUnpatch ( t , target , patch , expected )
428- } )
429-
430- test . skip ( 'editing lenght of array and also adding extra values' , function ( t ) {
431- const target = { objarr : [ 0 , 1 ] }
432- const patch = { objarr : { 3 : 3 , length : 5 } }
433- const expected = { objarr : [ 0 , 1 , undefined , 3 , undefined ] }
434-
435- testPatchUnpatch ( t , target , patch , expected )
436- } )
437-
438406test ( 'should assign `null` values' , function ( t ) {
439407 const target = { value : false }
440408 const patch = { value : null }
@@ -601,6 +569,48 @@ test('checking different types and mutating multiple deep values', function (t)
601569 t . is ( mutations . length , 30 )
602570} )
603571
572+ // Inner arrays
573+ // Inner arrays
574+ // Inner arrays
575+ // Inner arrays
576+ // Inner arrays
577+ // Inner arrays
578+ // Inner arrays
579+ // Inner arrays
580+ // Inner arrays
581+
582+ test ( 'changing length of array' , function ( t ) {
583+ const target = { objarr : [ 0 , 1 ] }
584+ const patch = { objarr : { length : 4 } }
585+ const expected = { objarr : [ 0 , 1 , undefined , undefined ] }
586+
587+ testPatchUnpatch ( t , target , patch , expected )
588+ } )
589+
590+ test ( 'adding item to array ' , function ( t ) {
591+ const target = { objarr : [ 0 , 1 ] }
592+ const patch = { objarr : { 3 : { hello : 'world' } } }
593+ const expected = { objarr : [ 0 , 1 , undefined , { hello : 'world' } ] }
594+
595+ testPatchUnpatch ( t , target , patch , expected )
596+ } )
597+
598+ test ( 'adding multiple item to array ' , function ( t ) {
599+ const target = { objarr : [ 0 , 1 ] }
600+ const patch = { objarr : { 3 : 3 , 5 : 5 } }
601+ const expected = { objarr : [ 0 , 1 , undefined , 3 , undefined , 5 ] }
602+
603+ testPatchUnpatch ( t , target , patch , expected )
604+ } )
605+
606+ test ( 'editing length of array and also adding extra values' , function ( t ) {
607+ const target = { objarr : [ 0 , 1 ] }
608+ const patch = { objarr : { 3 : 3 , length : 5 } }
609+ const expected = { objarr : [ 0 , 1 , undefined , 3 , undefined ] }
610+
611+ testPatchUnpatch ( t , target , patch , expected )
612+ } )
613+
604614test ( 'Inner plain array' , function ( t ) {
605615 const target = [ { b : false } ]
606616 const patch = { 0 : { b : true } }
0 commit comments