Skip to content

Commit

Permalink
prepare tests for tape 5
Browse files Browse the repository at this point in the history
  • Loading branch information
angus-c committed Apr 27, 2020
1 parent 2ba98b0 commit 3c7122f
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 85 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"eslint": "6.8.0",
"lerna": "3.20.2",
"tap-spec": "5.0.0",
"tape": "4.13.2"
"tape": "^4.0.0"
},
"scripts": {
"lint": "eslint .",
Expand Down
18 changes: 12 additions & 6 deletions test/collection-diff-apply/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ test('arrays', function(t) {
});

test('object vs array', function(t) {
t.plan(4);
t.plan(7);
var obj9 = {a: 2};
var originalDiff = [
{op: 'remove', path: ['a']},
Expand All @@ -152,7 +152,7 @@ test('object vs array', function(t) {
];
var diff = clone(originalDiff);
diffApply(obj9, diff);
t.deepEqual(obj9, ['a', 2]);
t.deepEqual(obj9, {'0': 'a', '1': 2});
t.deepEqual(diff, originalDiff);

var obj10 = ['a', 2];
Expand All @@ -163,7 +163,10 @@ test('object vs array', function(t) {
];
var diff = clone(originalDiff);
diffApply(obj10, diff);
t.deepEqual(obj10, {a: 2});
t.ok(typeof obj10 == 'object');
t.ok(Array.isArray(obj10), true);
t.equal(obj10.a, 2);
t.equal(obj10.length, 0);
t.deepEqual(diff, originalDiff);
t.end();
});
Expand Down Expand Up @@ -303,7 +306,7 @@ test('arrays using js patch standard', function(t) {
});

test('object vs array using js patch standard', function(t) {
t.plan(4);
t.plan(7);
var obj9 = {a: 2};
var originalDiff = [
{op: 'remove', path: '/a'},
Expand All @@ -312,7 +315,7 @@ test('object vs array using js patch standard', function(t) {
];
var diff = clone(originalDiff);
diffApply(obj9, diff, jsonPatchPathConverter);
t.deepEqual(obj9, ['a', 2]);
t.deepEqual(obj9, {'0': 'a', '1': 2});
t.deepEqual(diff, originalDiff);

var obj10 = ['a', 2];
Expand All @@ -323,7 +326,10 @@ test('object vs array using js patch standard', function(t) {
];
var diff = clone(originalDiff);
diffApply(obj10, diff, jsonPatchPathConverter);
t.deepEqual(obj10, {a: 2});
t.ok(typeof obj10 == 'object');
t.ok(Array.isArray(obj10), true);
t.equal(obj10.a, 2);
t.equal(obj10.length, 0);
t.deepEqual(diff, originalDiff);
t.end();
});
Expand Down
Loading

0 comments on commit 3c7122f

Please sign in to comment.