WIP! A BB-style forum, on the ATmosphere!
We're still working... we'll be back soon when we have something to show off!
node
typescript
hono
htmx
atproto
1import { vi } from "vitest";
2import type { Logger } from "@atbb/logger";
3
4/**
5 * Create a mock Logger for unit tests.
6 * All methods are vi.fn() spies so tests can assert on calls.
7 */
8export function createMockLogger(): Logger & {
9 debug: ReturnType<typeof vi.fn>;
10 info: ReturnType<typeof vi.fn>;
11 warn: ReturnType<typeof vi.fn>;
12 error: ReturnType<typeof vi.fn>;
13 fatal: ReturnType<typeof vi.fn>;
14} {
15 const mock: Logger = {
16 debug: vi.fn(),
17 info: vi.fn(),
18 warn: vi.fn(),
19 error: vi.fn(),
20 fatal: vi.fn(),
21 child: vi.fn().mockReturnThis(),
22 shutdown: vi.fn().mockResolvedValue(undefined),
23 };
24 return mock as any;
25}