test: tighten root output assertions · openclaw/openclaw@fc32737
shakkernerd
·
2026-05-08
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -32,9 +32,10 @@ describe("appcast.xml", () => {
|
32 | 32 | expect(items.length).toBeGreaterThan(0); |
33 | 33 | |
34 | 34 | for (const item of items) { |
35 | | -expect(item.shortVersion, item.raw).not.toBeNull(); |
36 | | -expect(item.sparkleVersion, item.raw).not.toBeNull(); |
37 | | -expect(item.sparkleVersion).toBe(canonicalSparkleBuildFromVersion(item.shortVersion!)); |
| 35 | +if (item.shortVersion === null || item.sparkleVersion === null) { |
| 36 | +throw new Error(`Appcast entry missing version fields: ${item.raw}`); |
| 37 | +} |
| 38 | +expect(item.sparkleVersion).toBe(canonicalSparkleBuildFromVersion(item.shortVersion)); |
38 | 39 | } |
39 | 40 | }); |
40 | 41 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -34,14 +34,10 @@ describe("cli json stdout contract", () => {
|
34 | 34 | const stdout = result.stdout.trim(); |
35 | 35 | expect(stdout.length).toBeGreaterThan(0); |
36 | 36 | const parsed = JSON.parse(stdout) as unknown; |
37 | | -expect(typeof parsed).toBe("object"); |
38 | | -expect(parsed).not.toBeNull(); |
39 | | -expect(Array.isArray(parsed)).toBe(false); |
40 | | -expect(Object.keys(parsed as Record<string, unknown>).sort()).toEqual([ |
41 | | -"availability", |
42 | | -"channel", |
43 | | -"update", |
44 | | -]); |
| 37 | +if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) { |
| 38 | +throw new Error(`Expected JSON object stdout, got: ${stdout}`); |
| 39 | +} |
| 40 | +expect(Object.keys(parsed).sort()).toEqual(["availability", "channel", "update"]); |
45 | 41 | expect(stdout).not.toContain("Doctor warnings"); |
46 | 42 | expect(stdout).not.toContain("Doctor changes"); |
47 | 43 | expect(stdout).not.toContain("Config invalid"); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。