mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
2774a070d6
* fix(log): ensure consistent behavior with `@std/log` * update * fixes
20 lines
705 B
TypeScript
20 lines
705 B
TypeScript
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
import { assertEquals } from "@std/assert";
|
|
import { assertSpyCall, spy } from "@std/testing/mock";
|
|
import { bold, red } from "@std/fmt/colors";
|
|
import { critical } from "./critical.ts";
|
|
|
|
Deno.test("critical()", () => {
|
|
using consoleInfoSpy = spy(console, "log");
|
|
const criticalData: string = critical("foo");
|
|
const criticalResolver: string | undefined = critical(() => "bar");
|
|
assertEquals(criticalData, "foo");
|
|
assertEquals(criticalResolver, "bar");
|
|
assertSpyCall(consoleInfoSpy, 0, {
|
|
args: [bold(red("CRITICAL foo"))],
|
|
});
|
|
assertSpyCall(consoleInfoSpy, 1, {
|
|
args: [bold(red("CRITICAL bar"))],
|
|
});
|
|
});
|