-
Notifications
You must be signed in to change notification settings - Fork 72
/
dates.js
37 lines (35 loc) · 838 Bytes
/
dates.js
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
import { test } from "uvu";
import * as assert from "uvu/assert";
import diff from "../dist/index.js";
test("Handles equal dates", () => {
assert.equal(diff({ date: new Date(1) }, { date: new Date(1) }), []);
});
test("Handles unequal dates", () => {
assert.equal(diff({ date: new Date(1) }, { date: new Date(2) }), [
{
path: ["date"],
type: "CHANGE",
value: new Date(2),
oldValue: new Date(1),
},
]);
});
test("Handles value being a date and the other not", () => {
assert.equal(diff({ date: new Date(1) }, { date: "not date" }), [
{
path: ["date"],
type: "CHANGE",
value: "not date",
oldValue: new Date(1),
},
]);
assert.equal(diff({ date: "not date" }, { date: new Date(1) }), [
{
path: ["date"],
type: "CHANGE",
value: new Date(1),
oldValue: "not date",
},
]);
});
test.run();