mirror of
https://github.com/denoland/std.git
synced 2024-11-22 04:59:05 +00:00
b649680328
* test(assert): improve test coverage * chore: format * chore: lint * nits --------- Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
28 lines
827 B
TypeScript
28 lines
827 B
TypeScript
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
import { AssertionError, assertNotMatch, assertThrows } from "./mod.ts";
|
|
|
|
Deno.test("assertNotMatch()", () => {
|
|
assertNotMatch("foobar.deno.com", RegExp(/[a-zA-Z]+@[a-zA-Z]+.com/));
|
|
});
|
|
|
|
Deno.test("assertNotMatch() throws", () => {
|
|
assertThrows(
|
|
() => assertNotMatch("Denosaurus from Jurassic", RegExp(/from/)),
|
|
AssertionError,
|
|
`Expected actual: "Denosaurus from Jurassic" to not match: "/from/".`,
|
|
);
|
|
});
|
|
|
|
Deno.test("assertNotMatch() throws with custom message", () => {
|
|
assertThrows(
|
|
() =>
|
|
assertNotMatch(
|
|
"Denosaurus from Jurassic",
|
|
RegExp(/from/),
|
|
"CUSTOM MESSAGE",
|
|
),
|
|
AssertionError,
|
|
`Expected actual: "Denosaurus from Jurassic" to not match: "/from/": CUSTOM MESSAGE`,
|
|
);
|
|
});
|