test: tighten extension media assertions · openclaw/openclaw@8bf721f
steipete
·
2026-05-08
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -75,12 +75,9 @@ describe("transcribeOpenAiAudio", () => {
|
75 | 75 | expect(form.get("language")).toBe("en"); |
76 | 76 | expect(form.get("prompt")).toBe("hello"); |
77 | 77 | const file = form.get("file") as Blob | { type?: string; name?: string } | null; |
78 | | -expect(file).not.toBeNull(); |
79 | | -if (file) { |
80 | | -expect(file.type).toBe("audio/wav"); |
81 | | -if ("name" in file && typeof file.name === "string") { |
82 | | -expect(file.name).toBe("voice.wav"); |
83 | | -} |
| 78 | +expect(file).toEqual(expect.objectContaining({ type: "audio/wav" })); |
| 79 | +if (file && "name" in file && typeof file.name === "string") { |
| 80 | +expect(file.name).toBe("voice.wav"); |
84 | 81 | } |
85 | 82 | }); |
86 | 83 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -22,7 +22,7 @@ function installQaChannelTestRegistry() {
|
22 | 22 | } |
23 | 23 | |
24 | 24 | function expectDispatchedContext(ctx: Record<string, unknown> | null): Record<string, unknown> { |
25 | | -expect(ctx).not.toBeNull(); |
| 25 | +expect(ctx).toEqual(expect.any(Object)); |
26 | 26 | if (ctx === null) { |
27 | 27 | throw new Error("Expected dispatched context"); |
28 | 28 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -972,7 +972,7 @@ describe("qa bundled plugin dir", () => {
|
972 | 972 | expect(stagedRoot).toBe( |
973 | 973 | path.join(repoRoot, ".artifacts", "qa-runtime", path.basename(tempRoot)), |
974 | 974 | ); |
975 | | -await expect(readFile(path.join(stagedRoot!, "package.json"), "utf8")).resolves.toContain( |
| 975 | +await expect(readFile(path.join(stagedRoot, "package.json"), "utf8")).resolves.toContain( |
976 | 976 | '"name": "openclaw"', |
977 | 977 | ); |
978 | 978 | await expect( |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -78,12 +78,9 @@ describe("transcribeSenseAudioAudio", () => {
|
78 | 78 | expect(form.get("language")).toBe("en"); |
79 | 79 | expect(form.get("prompt")).toBe("hello"); |
80 | 80 | const file = form.get("file") as Blob | { type?: string; name?: string } | null; |
81 | | -expect(file).not.toBeNull(); |
82 | | -if (file) { |
83 | | -expect(file.type).toBe("audio/wav"); |
84 | | -if ("name" in file && typeof file.name === "string") { |
85 | | -expect(file.name).toBe("voice.wav"); |
86 | | -} |
| 81 | +expect(file).toEqual(expect.objectContaining({ type: "audio/wav" })); |
| 82 | +if (file && "name" in file && typeof file.name === "string") { |
| 83 | +expect(file.name).toBe("voice.wav"); |
87 | 84 | } |
88 | 85 | }); |
89 | 86 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。