UNPKG

@riddance/service

Version:

Too much code slows you down, creates risks, increases maintainability burdens, confuses AI. So let's commit less of it.

49 lines (48 loc) 1.63 kB
import { ClientInfo, LogEntry, LogTransport } from '@riddance/host/context'; import { FullConfiguration, Metadata } from '@riddance/host/registry'; import { Environment, type JsonObject, type JsonSafe, type Stringified } from '../context.js'; export declare const mochaHooks: { beforeAll(): Promise<void>; beforeEach(): Promise<void>; afterEach: (this: Mocha.Context) => Promise<void>; }; export declare function jsonRoundtrip<T extends JsonSafe>(obj: T | undefined): Stringified<T> | undefined; export declare function createMockContext(client: ClientInfo, config?: FullConfiguration, meta?: Metadata): { log: import("@riddance/host/context").RootLogger; context: Omit<import("@riddance/host/lib/context").Context, "log">; success: () => Promise<unknown>; flush: () => Promise<void>; }; export declare function getTestContext(): TestContext; declare class MockLogger implements LogTransport { #private; failOnErrorLogs: boolean; failed: boolean; getEntries(): LogEntry[]; clear(): void; sendEntries(entries: LogEntry[]): undefined; dumpLog(testTitle: string): Promise<void>; writeLog(): Promise<string | undefined>; } type Event = { topic: string; type: string; subject: string; data?: JsonObject; messageId: string | undefined; }; declare class TestContext { readonly log: MockLogger; get env(): { [key: string]: string; }; environment: { [key: string]: string; }; emitted: Event[]; frozenTime: number | undefined; timeShift: number; constructor(env: Environment); now(): Date; } export {};