mirror of
https://github.com/denoland/deno.git
synced 2024-11-23 15:16:54 -05:00
33 lines
608 B
TypeScript
33 lines
608 B
TypeScript
|
import { assert, DenoStdInternalError } from "./assert.ts";
|
||
|
import { assertThrows } from "../testing/asserts.ts";
|
||
|
|
||
|
const { test } = Deno;
|
||
|
|
||
|
test({
|
||
|
name: "assert valid scenario",
|
||
|
fn(): void {
|
||
|
assert(true);
|
||
|
},
|
||
|
});
|
||
|
|
||
|
test({
|
||
|
name: "assert invalid scenario, no message",
|
||
|
fn(): void {
|
||
|
assertThrows(() => {
|
||
|
assert(false);
|
||
|
}, DenoStdInternalError);
|
||
|
},
|
||
|
});
|
||
|
test({
|
||
|
name: "assert invalid scenario, with message",
|
||
|
fn(): void {
|
||
|
assertThrows(
|
||
|
() => {
|
||
|
assert(false, "Oops! Should be true");
|
||
|
},
|
||
|
DenoStdInternalError,
|
||
|
"Oops! Should be true"
|
||
|
);
|
||
|
},
|
||
|
});
|