test: require active video task status · openclaw/openclaw@827354b
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -15,6 +15,15 @@ const taskRuntimeInternalMocks = vi.hoisted(() => ({
|
15 | 15 | |
16 | 16 | vi.mock("../tasks/runtime-internal.js", () => taskRuntimeInternalMocks); |
17 | 17 | |
| 18 | +function expectActiveVideoGenerationTask( |
| 19 | +task: ReturnType<typeof findActiveVideoGenerationTaskForSession>, |
| 20 | +): NonNullable<ReturnType<typeof findActiveVideoGenerationTaskForSession>> { |
| 21 | +if (task == null) { |
| 22 | +throw new Error("Expected active video generation task"); |
| 23 | +} |
| 24 | +return task; |
| 25 | +} |
| 26 | + |
18 | 27 | describe("video generation task status", () => { |
19 | 28 | beforeEach(() => { |
20 | 29 | taskRuntimeInternalMocks.listTasksForOwnerKey.mockReset(); |
@@ -92,11 +101,12 @@ describe("video generation task status", () => {
|
92 | 101 | const task = findActiveVideoGenerationTaskForSession("agent:main"); |
93 | 102 | |
94 | 103 | expect(task?.taskId).toBe("task-running"); |
95 | | -expect(getVideoGenerationTaskProviderId(task!)).toBe("openai"); |
96 | | -expect(buildVideoGenerationTaskStatusText(task!, { duplicateGuard: true })).toContain( |
| 104 | +const activeTask = expectActiveVideoGenerationTask(task); |
| 105 | +expect(getVideoGenerationTaskProviderId(activeTask)).toBe("openai"); |
| 106 | +expect(buildVideoGenerationTaskStatusText(activeTask, { duplicateGuard: true })).toContain( |
97 | 107 | "Do not call video_generate again for this request.", |
98 | 108 | ); |
99 | | -expect(buildVideoGenerationTaskStatusDetails(task!)).toMatchObject({ |
| 109 | +expect(buildVideoGenerationTaskStatusDetails(activeTask)).toMatchObject({ |
100 | 110 | active: true, |
101 | 111 | existingTask: true, |
102 | 112 | status: "running", |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。