mirror of
https://github.com/denoland/std.git
synced 2024-11-22 04:59:05 +00:00
2774a070d6
* fix(log): ensure consistent behavior with `@std/log` * update * fixes
21 lines
678 B
TypeScript
21 lines
678 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 { yellow } from "@std/fmt/colors";
|
|
import { warn } from "./warn.ts";
|
|
|
|
Deno.test("warn()", () => {
|
|
using consoleInfoSpy = spy(console, "log");
|
|
const sym = Symbol("a");
|
|
const warnData: symbol = warn(sym);
|
|
const warnResolver: null | undefined = warn(() => null);
|
|
assertEquals(warnData, sym);
|
|
assertEquals(warnResolver, null);
|
|
assertSpyCall(consoleInfoSpy, 0, {
|
|
args: [yellow("WARN Symbol(a)")],
|
|
});
|
|
assertSpyCall(consoleInfoSpy, 1, {
|
|
args: [yellow("WARN null")],
|
|
});
|
|
});
|