mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:50:43 +00:00
test(tasks): align detached runtime mock return types
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import type { TaskRecord } from "./task-registry.types.js";
|
||||
import {
|
||||
completeTaskRunByRunId,
|
||||
createQueuedTaskRun,
|
||||
@@ -12,6 +11,7 @@ import {
|
||||
setDetachedTaskDeliveryStatusByRunId,
|
||||
startTaskRunByRunId,
|
||||
} from "./detached-task-runtime.js";
|
||||
import type { TaskRecord } from "./task-registry.types.js";
|
||||
|
||||
function createFakeTaskRecord(overrides?: Partial<TaskRecord>): TaskRecord {
|
||||
return {
|
||||
@@ -46,15 +46,16 @@ describe("detached-task-runtime", () => {
|
||||
taskId: "task-running",
|
||||
runId: "run-running",
|
||||
});
|
||||
const updatedTasks = [runningTask];
|
||||
|
||||
const fakeRuntime = {
|
||||
createQueuedTaskRun: vi.fn(() => queuedTask),
|
||||
createRunningTaskRun: vi.fn(() => runningTask),
|
||||
startTaskRunByRunId: vi.fn(() => undefined),
|
||||
recordTaskRunProgressByRunId: vi.fn(() => undefined),
|
||||
completeTaskRunByRunId: vi.fn(() => undefined),
|
||||
failTaskRunByRunId: vi.fn(() => undefined),
|
||||
setDetachedTaskDeliveryStatusByRunId: vi.fn(() => undefined),
|
||||
startTaskRunByRunId: vi.fn(() => updatedTasks),
|
||||
recordTaskRunProgressByRunId: vi.fn(() => updatedTasks),
|
||||
completeTaskRunByRunId: vi.fn(() => updatedTasks),
|
||||
failTaskRunByRunId: vi.fn(() => updatedTasks),
|
||||
setDetachedTaskDeliveryStatusByRunId: vi.fn(() => updatedTasks),
|
||||
};
|
||||
|
||||
setDetachedTaskLifecycleRuntime(fakeRuntime);
|
||||
|
||||
Reference in New Issue
Block a user