test: tighten e2e helper assertions · openclaw/openclaw@dce9261
steipete
·
2026-05-08
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -47,7 +47,8 @@ function asRecord(value: unknown): Record<string, unknown> {
|
47 | 47 | } |
48 | 48 | |
49 | 49 | function expectRecord(value: unknown, label: string): Record<string, unknown> { |
50 | | -expect(value, label).toEqual(expect.any(Object)); |
| 50 | +expect(value, label).toBeTypeOf("object"); |
| 51 | +expect(value, label).not.toBeNull(); |
51 | 52 | expect(Array.isArray(value), label).toBe(false); |
52 | 53 | return value as Record<string, unknown>; |
53 | 54 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -88,7 +88,8 @@ describe("gateway cli backend live helpers", () => {
|
88 | 88 | token: "gateway-token", |
89 | 89 | }); |
90 | 90 | |
91 | | -expect(client).toEqual(expect.any(Object)); |
| 91 | +expect(client).toBeTypeOf("object"); |
| 92 | +expect(client).not.toBeNull(); |
92 | 93 | expect(gatewayClientState.lastOptions).toMatchObject({ |
93 | 94 | url: "ws://127.0.0.1:18789", |
94 | 95 | token: "gateway-token", |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -34,7 +34,9 @@ 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(parsed).toEqual(expect.any(Object)); |
| 37 | +expect(parsed).toBeTypeOf("object"); |
| 38 | +expect(parsed).not.toBeNull(); |
| 39 | +expect(Array.isArray(parsed)).toBe(false); |
38 | 40 | expect(stdout).not.toContain("Doctor warnings"); |
39 | 41 | expect(stdout).not.toContain("Doctor changes"); |
40 | 42 | expect(stdout).not.toContain("Config invalid"); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -481,7 +481,7 @@ console.log(JSON.stringify(result));
|
481 | 481 | ) as { status: number; stdout: string }; |
482 | 482 | |
483 | 483 | expect(result.status).toBe(124); |
484 | | -expect(result.stdout).toEqual(expect.any(String)); |
| 484 | +expect(result.stdout).toBeTypeOf("string"); |
485 | 485 | }); |
486 | 486 | |
487 | 487 | it("runs the Windows agent turn through the detached done-file runner", () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。