mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-16 11:50:53 +00:00
test: tighten media status assertions
This commit is contained in:
@@ -52,20 +52,29 @@ describe("createMusicGenerateTool status actions", () => {
|
||||
expect(result?.content).toHaveLength(1);
|
||||
expect(text).toContain("Music generation task task-active is already running with google.");
|
||||
expect(text).toContain("Do not call music_generate again for this request.");
|
||||
expect(result?.details).toMatchObject({
|
||||
action: "status",
|
||||
duplicateGuard: true,
|
||||
active: true,
|
||||
existingTask: true,
|
||||
status: "running",
|
||||
taskKind: MUSIC_GENERATION_TASK_KIND,
|
||||
provider: "google",
|
||||
task: {
|
||||
taskId: "task-active",
|
||||
runId: "tool:music_generate:active",
|
||||
},
|
||||
progressSummary: "Generating music",
|
||||
});
|
||||
const details = result?.details as
|
||||
| {
|
||||
action?: unknown;
|
||||
duplicateGuard?: unknown;
|
||||
active?: unknown;
|
||||
existingTask?: unknown;
|
||||
status?: unknown;
|
||||
taskKind?: unknown;
|
||||
provider?: unknown;
|
||||
task?: { taskId?: unknown; runId?: unknown };
|
||||
progressSummary?: unknown;
|
||||
}
|
||||
| undefined;
|
||||
expect(details?.action).toBe("status");
|
||||
expect(details?.duplicateGuard).toBe(true);
|
||||
expect(details?.active).toBe(true);
|
||||
expect(details?.existingTask).toBe(true);
|
||||
expect(details?.status).toBe("running");
|
||||
expect(details?.taskKind).toBe(MUSIC_GENERATION_TASK_KIND);
|
||||
expect(details?.provider).toBe("google");
|
||||
expect(details?.task?.taskId).toBe("task-active");
|
||||
expect(details?.task?.runId).toBe("tool:music_generate:active");
|
||||
expect(details?.progressSummary).toBe("Generating music");
|
||||
});
|
||||
|
||||
it("reports active task status when action=status is requested", () => {
|
||||
@@ -92,17 +101,23 @@ describe("createMusicGenerateTool status actions", () => {
|
||||
const text = (result.content?.[0] as { text: string } | undefined)?.text ?? "";
|
||||
|
||||
expect(text).toContain("Music generation task task-active is already queued with minimax.");
|
||||
expect(result.details).toMatchObject({
|
||||
action: "status",
|
||||
active: true,
|
||||
existingTask: true,
|
||||
status: "queued",
|
||||
taskKind: MUSIC_GENERATION_TASK_KIND,
|
||||
provider: "minimax",
|
||||
task: {
|
||||
taskId: "task-active",
|
||||
},
|
||||
progressSummary: "Queued music generation",
|
||||
});
|
||||
const details = result.details as {
|
||||
action?: unknown;
|
||||
active?: unknown;
|
||||
existingTask?: unknown;
|
||||
status?: unknown;
|
||||
taskKind?: unknown;
|
||||
provider?: unknown;
|
||||
task?: { taskId?: unknown };
|
||||
progressSummary?: unknown;
|
||||
};
|
||||
expect(details.action).toBe("status");
|
||||
expect(details.active).toBe(true);
|
||||
expect(details.existingTask).toBe(true);
|
||||
expect(details.status).toBe("queued");
|
||||
expect(details.taskKind).toBe(MUSIC_GENERATION_TASK_KIND);
|
||||
expect(details.provider).toBe("minimax");
|
||||
expect(details.task?.taskId).toBe("task-active");
|
||||
expect(details.progressSummary).toBe("Queued music generation");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -66,7 +66,7 @@ describe("sessions_history redaction", () => {
|
||||
|
||||
expect(serialized).not.toContain("sk-or-v1-abcdef0123456789");
|
||||
expect(serialized).toContain("OPENROUTER_API_KEY=");
|
||||
expect(result.details).toMatchObject({ contentRedacted: true });
|
||||
expect((result.details as { contentRedacted?: unknown }).contentRedacted).toBe(true);
|
||||
});
|
||||
|
||||
it("applies custom redaction patterns to recalled session text", async () => {
|
||||
@@ -81,6 +81,6 @@ describe("sessions_history redaction", () => {
|
||||
|
||||
expect(serialized).not.toContain("internal-ticket-AbC12345");
|
||||
expect(serialized).toContain("intern");
|
||||
expect(result.details).toMatchObject({ contentRedacted: true });
|
||||
expect((result.details as { contentRedacted?: unknown }).contentRedacted).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user