test: tighten extension media assertions

This commit is contained in:
Peter Steinberger
2026-05-08 16:46:52 +01:00
parent 9c584567b3
commit 8bf721f307
4 changed files with 8 additions and 14 deletions

View File

@@ -75,12 +75,9 @@ describe("transcribeOpenAiAudio", () => {
expect(form.get("language")).toBe("en");
expect(form.get("prompt")).toBe("hello");
const file = form.get("file") as Blob | { type?: string; name?: string } | null;
expect(file).not.toBeNull();
if (file) {
expect(file.type).toBe("audio/wav");
if ("name" in file && typeof file.name === "string") {
expect(file.name).toBe("voice.wav");
}
expect(file).toEqual(expect.objectContaining({ type: "audio/wav" }));
if (file && "name" in file && typeof file.name === "string") {
expect(file.name).toBe("voice.wav");
}
});

View File

@@ -22,7 +22,7 @@ function installQaChannelTestRegistry() {
}
function expectDispatchedContext(ctx: Record<string, unknown> | null): Record<string, unknown> {
expect(ctx).not.toBeNull();
expect(ctx).toEqual(expect.any(Object));
if (ctx === null) {
throw new Error("Expected dispatched context");
}

View File

@@ -972,7 +972,7 @@ describe("qa bundled plugin dir", () => {
expect(stagedRoot).toBe(
path.join(repoRoot, ".artifacts", "qa-runtime", path.basename(tempRoot)),
);
await expect(readFile(path.join(stagedRoot!, "package.json"), "utf8")).resolves.toContain(
await expect(readFile(path.join(stagedRoot, "package.json"), "utf8")).resolves.toContain(
'"name": "openclaw"',
);
await expect(

View File

@@ -78,12 +78,9 @@ describe("transcribeSenseAudioAudio", () => {
expect(form.get("language")).toBe("en");
expect(form.get("prompt")).toBe("hello");
const file = form.get("file") as Blob | { type?: string; name?: string } | null;
expect(file).not.toBeNull();
if (file) {
expect(file.type).toBe("audio/wav");
if ("name" in file && typeof file.name === "string") {
expect(file.name).toBe("voice.wav");
}
expect(file).toEqual(expect.objectContaining({ type: "audio/wav" }));
if (file && "name" in file && typeof file.name === "string") {
expect(file.name).toBe("voice.wav");
}
});