mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 03:31:23 +00:00
chore: Fix types in tests 10/N.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { vi } from "vitest";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
import type { MockFn } from "../test-utils/vitest-mock-fn.js";
|
||||
|
||||
export const baseConfigSnapshot = {
|
||||
@@ -13,15 +14,18 @@ export const baseConfigSnapshot = {
|
||||
};
|
||||
|
||||
export type TestRuntime = {
|
||||
log: MockFn;
|
||||
error: MockFn;
|
||||
exit: MockFn;
|
||||
log: MockFn<RuntimeEnv["log"]>;
|
||||
error: MockFn<RuntimeEnv["error"]>;
|
||||
exit: MockFn<RuntimeEnv["exit"]>;
|
||||
};
|
||||
|
||||
export function createTestRuntime(): TestRuntime {
|
||||
const log = vi.fn() as MockFn<RuntimeEnv["log"]>;
|
||||
const error = vi.fn() as MockFn<RuntimeEnv["error"]>;
|
||||
const exit = vi.fn((_: number) => undefined) as MockFn<RuntimeEnv["exit"]>;
|
||||
return {
|
||||
log: vi.fn(),
|
||||
error: vi.fn(),
|
||||
exit: vi.fn(),
|
||||
log,
|
||||
error,
|
||||
exit,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user