forked from denoland/std
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnot_equals_test.ts
43 lines (40 loc) · 1.07 KB
/
not_equals_test.ts
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
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { AssertionError, assertNotEquals, assertThrows } from "./mod.ts";
Deno.test("assertNotEquals()", () => {
assertNotEquals<unknown>({ foo: "bar" }, { bar: "foo" });
assertNotEquals("Denosaurus", "Tyrannosaurus");
assertNotEquals(
new Date(2019, 0, 3, 4, 20, 1, 10),
new Date(2019, 0, 3, 4, 20, 1, 20),
);
assertNotEquals(new Date("invalid"), new Date(2019, 0, 3, 4, 20, 1, 20));
});
Deno.test("assertNotEquals() throws", () => {
assertThrows(
() => {
assertNotEquals("foo", "foo");
},
AssertionError,
'Expected actual: "foo" not to be: "foo".',
);
assertThrows(
() => {
assertNotEquals({ foo: 1 }, { foo: 1 });
},
AssertionError,
`Expected actual: {
foo: 1,
} not to be: {
foo: 1,
}.`,
);
});
Deno.test("assertNotEquals() throws with custom message", () => {
assertThrows(
() => {
assertNotEquals("foo", "foo", "CUSTOM MESSAGE");
},
AssertionError,
'Expected actual: "foo" not to be: "foo": CUSTOM MESSAGE',
);
});