mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-12-05 06:41:50 +09:00
20 lines
413 B
TypeScript
20 lines
413 B
TypeScript
import { afterEach, expect, test, vi } from "vitest";
|
|
import { printJson } from "./json-output";
|
|
|
|
afterEach(() => {
|
|
vi.restoreAllMocks();
|
|
});
|
|
|
|
test("prints pretty JSON", () => {
|
|
vi.spyOn(console, "info").mockImplementation(() => undefined);
|
|
|
|
printJson({ ok: true, data: { value: 1 } });
|
|
|
|
expect(vi.mocked(console.info).mock.calls.at(-1)?.[0]).toBe(`{
|
|
"ok": true,
|
|
"data": {
|
|
"value": 1
|
|
}
|
|
}`);
|
|
});
|