forked from Khan/perseus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiffer-test.js
More file actions
41 lines (31 loc) · 1.12 KB
/
differ-test.js
File metadata and controls
41 lines (31 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var diff = require("../src/diffs/widget-diff-performer.jsx");
test("same single value", function() {
var sameValue = diff("a", "a");
strictEqual(sameValue.status, "unchanged");
});
test("different single value", function() {
var differentValue = diff("a", "b");
strictEqual(differentValue.status, "changed");
});
test("two identical objects", function() {
var objSame = diff({a: "b"}, {a: "b"});
strictEqual(objSame.status, "unchanged");
strictEqual(objSame.children.length, 1);
var child = objSame.children[0];
strictEqual(child.status, "unchanged");
});
test("two different objects", function() {
var objDiff = diff({a: "b"}, {a: "c"});
strictEqual(objDiff.status, "changed");
strictEqual(objDiff.children.length, 1);
var diffChild = objDiff.children[0];
strictEqual(diffChild.status, "changed");
});
test("a removed object", function() {
var removedObj = diff({a: "b"}, {});
strictEqual(removedObj.children[0].status, "removed");
});
test("an added object", function() {
var addedObj = diff({}, {a: "c"});
strictEqual(addedObj.children[0].status, "added");
});