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
672 B
TypeScript
20 lines
672 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 { red } from "@std/fmt/colors";
|
|
import { error } from "./error.ts";
|
|
|
|
Deno.test("error()", () => {
|
|
using consoleInfoSpy = spy(console, "log");
|
|
const errorData: undefined = error(undefined, 1, 2, 3);
|
|
const errorResolver: bigint | undefined = error(() => 5n);
|
|
assertEquals(errorData, undefined);
|
|
assertEquals(errorResolver, 5n);
|
|
assertSpyCall(consoleInfoSpy, 0, {
|
|
args: [red("ERROR undefined")],
|
|
});
|
|
assertSpyCall(consoleInfoSpy, 1, {
|
|
args: [red("ERROR 5")],
|
|
});
|
|
});
|