test: tighten remaining object assertions · openclaw/openclaw@d2c1f94
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -130,7 +130,9 @@ describeLive("xai live", () => {
|
130 | 130 | : []; |
131 | 131 | expect(payloadTools.length).toBeGreaterThan(0); |
132 | 132 | const firstFunction = payloadTools[0]?.function; |
133 | | -expect(firstFunction).toEqual(expect.any(Object)); |
| 133 | +expect(firstFunction).not.toBeNull(); |
| 134 | +expect(typeof firstFunction).toBe("object"); |
| 135 | +expect(Array.isArray(firstFunction)).toBe(false); |
134 | 136 | expect([undefined, false]).toContain((firstFunction as Record<string, unknown>).strict); |
135 | 137 | }); |
136 | 138 | }, 90_000); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -175,7 +175,10 @@ describe("doctor command", () => {
|
175 | 175 | } |
176 | 176 | const profiles = (written.auth as { profiles: Record<string, unknown> }).profiles; |
177 | 177 | expect(profiles).toHaveProperty("anthropic:me@example.com"); |
178 | | -expect(profiles["anthropic:me@example.com"]).toEqual(expect.any(Object)); |
| 178 | +expect(profiles["anthropic:me@example.com"]).toMatchObject({ |
| 179 | +provider: "anthropic", |
| 180 | +mode: "oauth", |
| 181 | +}); |
179 | 182 | expect(profiles["anthropic:default"]).toBeUndefined(); |
180 | 183 | }, 30_000); |
181 | 184 | }); |
| 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).not.toBeNull(); |
| 51 | +expect(typeof value, label).toBe("object"); |
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 |
|---|
@@ -53,7 +53,8 @@ function collectSchemaPaths(schema: unknown, prefix = ""): string[] {
|
53 | 53 | } |
54 | 54 | |
55 | 55 | function asRecord(value: unknown): Record<string, unknown> { |
56 | | -expect(value).toEqual(expect.any(Object)); |
| 56 | +expect(value).not.toBeNull(); |
| 57 | +expect(typeof value).toBe("object"); |
57 | 58 | expect(Array.isArray(value)).toBe(false); |
58 | 59 | return value as Record<string, unknown>; |
59 | 60 | } |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。