Skip to content

Commit 288185e

Browse files
committed
small changes
1 parent 7580cf6 commit 288185e

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"printWidth": 80,
3+
"tabWidth": 4,
4+
"semi": false,
5+
"singleQuote": true,
6+
"bracketSpacing": true
7+
}

package.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,5 @@
6060
"require": [
6161
"esm"
6262
]
63-
},
64-
"prettier": {
65-
"printWidth": 80,
66-
"tabWidth": 4,
67-
"semi": false,
68-
"singleQuote": true,
69-
"bracketSpacing": true
7063
}
7164
}

test/applyPatch.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
612604
test('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

620614
test('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+
628630
test('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

Comments
 (0)