summaryrefslogtreecommitdiff
path: root/std/testing/asserts_test.ts
diff options
context:
space:
mode:
authorSchwarzkopf Balázs <schwarzkopfb@icloud.com>2020-08-20 17:56:31 +0200
committerGitHub <noreply@github.com>2020-08-20 11:56:31 -0400
commit87b1b8c461d54170d2cd2d9232659837c1eeadc0 (patch)
tree61e69e9b1be0dd17b149e75e00b66a7e815b44b0 /std/testing/asserts_test.ts
parent5adb6cba3ee443801a4d54e894284183ef096364 (diff)
fix(std/node): misnamed assert exports (#7123)
Diffstat (limited to 'std/testing/asserts_test.ts')
-rw-r--r--std/testing/asserts_test.ts32
1 files changed, 31 insertions, 1 deletions
diff --git a/std/testing/asserts_test.ts b/std/testing/asserts_test.ts
index 7ea73b5c0..65645b06b 100644
--- a/std/testing/asserts_test.ts
+++ b/std/testing/asserts_test.ts
@@ -8,6 +8,7 @@ import {
assertMatch,
assertEquals,
assertStrictEquals,
+ assertNotStrictEquals,
assertThrows,
assertThrowsAsync,
AssertionError,
@@ -463,13 +464,42 @@ Deno.test({
});
Deno.test({
- name: "assert* functions with specified type paratemeter",
+ name: "strictly unequal pass case",
+ fn(): void {
+ assertNotStrictEquals(true, false);
+ assertNotStrictEquals(10, 11);
+ assertNotStrictEquals("abc", "xyz");
+ assertNotStrictEquals(1, "1");
+
+ const xs = [1, false, "foo"];
+ const ys = [1, true, "bar"];
+ assertNotStrictEquals(xs, ys);
+
+ const x = { a: 1 };
+ const y = { a: 2 };
+ assertNotStrictEquals(x, y);
+ },
+});
+
+Deno.test({
+ name: "strictly unequal fail case",
+ fn(): void {
+ assertThrows(
+ () => assertNotStrictEquals(1, 1),
+ AssertionError,
+ );
+ },
+});
+
+Deno.test({
+ name: "assert* functions with specified type parameter",
fn(): void {
assertEquals<string>("hello", "hello");
assertNotEquals<number>(1, 2);
assertArrayContains<boolean>([true, false], [true]);
const value = { x: 1 };
assertStrictEquals<typeof value>(value, value);
+ assertNotStrictEquals<object>(value, { x: 1 });
},
});