Skip to content

Commit 866d87d

Browse files
authored
Fix top level string test, verify application in tests. (#18)
1 parent 5e492a8 commit 866d87d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/index.test.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ let assert = require("assert");
55
// Library we're testing
66
let jsondiff = require("../index.js");
77
// json0 transform to work out if the right transform is being created
8-
let json0 = require("ot-json0/lib/json0");
8+
let json0 = require("ot-json0");
99
// Assertion expectations
1010
let expect = require("chai").expect;
1111
// Library for computing differences between strings
@@ -244,8 +244,8 @@ describe("Jsondiff", function() {
244244
start: "one",
245245
end: "two",
246246
expectedCommand: [
247-
{ sd: "one", p: [] },
248-
{ si: "two", p: [] }
247+
{ sd: "one", p: [0] },
248+
{ si: "two", p: [0] }
249249
]
250250
},
251251
{
@@ -305,6 +305,10 @@ describe("Jsondiff", function() {
305305
it(test.name, function() {
306306
let output = jsondiff(test.start, test.end, diffMatchPatch);
307307
expect(output).to.deep.equal(test.expectedCommand);
308+
309+
// Test actual application of the expected command.
310+
let appliedEnd = json0.type.apply(test.start, test.expectedCommand);
311+
expect(appliedEnd).to.deep.equal(test.end);
308312
});
309313
});
310314
});

0 commit comments

Comments
 (0)