2024-01-01 21:11:32 +00:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2024-05-07 00:08:16 +00:00
|
|
|
import { AssertionError, assertNotEquals, assertThrows } from "./mod.ts";
|
2023-07-13 07:04:30 +00:00
|
|
|
|
2024-05-07 00:08:16 +00:00
|
|
|
Deno.test("assertNotEquals()", () => {
|
|
|
|
assertNotEquals<unknown>({ foo: "bar" }, { bar: "foo" });
|
2023-07-13 07:04:30 +00:00
|
|
|
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));
|
2024-05-07 00:08:16 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
Deno.test("assertNotEquals() throws", () => {
|
|
|
|
assertThrows(
|
|
|
|
() => {
|
|
|
|
assertNotEquals("foo", "foo");
|
|
|
|
},
|
|
|
|
AssertionError,
|
|
|
|
"Expected actual: foo not to be: foo.",
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
Deno.test("assertNotEquals() throws with custom message", () => {
|
|
|
|
assertThrows(
|
|
|
|
() => {
|
|
|
|
assertNotEquals("foo", "foo", "CUSTOM MESSAGE");
|
|
|
|
},
|
|
|
|
AssertionError,
|
|
|
|
"Expected actual: foo not to be: foo: CUSTOM MESSAGE",
|
|
|
|
);
|
|
|
|
});
|