mirror of
https://github.com/denoland/std.git
synced 2024-11-22 04:59:05 +00:00
11 lines
404 B
TypeScript
11 lines
404 B
TypeScript
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
import { assert, AssertionError, assertThrows } from "./mod.ts";
|
|
|
|
Deno.test("assert() throws if expr is falsy", () => {
|
|
const FALSY_VALUES = [false, 0, "", null, undefined, NaN];
|
|
for (const value of FALSY_VALUES) {
|
|
const msg = crypto.randomUUID();
|
|
assertThrows(() => assert(value, msg), AssertionError, msg);
|
|
}
|
|
});
|