Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let assert = require("assert");
// Library we're testing
let jsondiff = require("../index.js");
// json0 transform to work out if the right transform is being created
let json0 = require("ot-json0/lib/json0");
let json0 = require("ot-json0");
// Assertion expectations
let expect = require("chai").expect;
// Library for computing differences between strings
Expand Down Expand Up @@ -244,8 +244,8 @@ describe("Jsondiff", function() {
start: "one",
end: "two",
expectedCommand: [
{ sd: "one", p: [] },
{ si: "two", p: [] }
{ sd: "one", p: [0] },
{ si: "two", p: [0] }
]
},
{
Expand Down Expand Up @@ -305,6 +305,10 @@ describe("Jsondiff", function() {
it(test.name, function() {
let output = jsondiff(test.start, test.end, diffMatchPatch);
expect(output).to.deep.equal(test.expectedCommand);

// Test actual application of the expected command.
let appliedEnd = json0.type.apply(test.start, test.expectedCommand);
expect(appliedEnd).to.deep.equal(test.end);
});
});
});
Expand Down