deno.land / x / microdiff@v1.4.0 / tests / nan.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import test from "node:test";import assert from "node:assert";import diff from "../dist/index.js";
test("new NaN value in object", () => { assert.deepStrictEqual(diff({}, { testNaN: NaN }), [ { type: "CREATE", path: ["testNaN"], value: NaN, }, ]);});test("change NaN value in object", () => { assert.deepStrictEqual(diff({ testNaN: NaN }, { testNaN: 0 }), [ { type: "CHANGE", path: ["testNaN"], value: 0, oldValue: NaN, }, ]);});test("do not change NaN value in object", () => { assert.deepStrictEqual(diff({ testNaN: NaN }, { testNaN: NaN }), []);});test("remove NaN value in object", () => { assert.deepStrictEqual(diff({ testNaN: NaN }, {}), [ { type: "REMOVE", path: ["testNaN"], oldValue: NaN, }, ]);});test("new NaN value in array", () => { assert.deepStrictEqual(diff([], [NaN]), [ { type: "CREATE", path: [0], value: NaN, }, ]);});test("change NaN value in object", () => { assert.deepStrictEqual(diff([NaN], [0]), [ { type: "CHANGE", path: [0], value: 0, oldValue: NaN, }, ]);});test("do not change NaN value in array", () => { assert.deepStrictEqual(diff([NaN], [NaN]), []);});
microdiff

Version Info

Tagged at
2 months ago