test: guard codex record assertions · openclaw/openclaw@82a243d
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -33,9 +33,9 @@ function createFakeCodexClient(): CodexAppServerClient {
|
33 | 33 | } |
34 | 34 | |
35 | 35 | function expectRecordFields(value: unknown, expected: Record<string, unknown>) { |
36 | | -expect(value).toBeDefined(); |
37 | | -expect(typeof value).toBe("object"); |
38 | | -expect(value).not.toBeNull(); |
| 36 | +if (!value || typeof value !== "object") { |
| 37 | + throw new Error("Expected record"); |
| 38 | +} |
39 | 39 | const actual = value as Record<string, unknown>; |
40 | 40 | for (const [key, expectedValue] of Object.entries(expected)) { |
41 | 41 | expect(actual[key]).toEqual(expectedValue); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -70,7 +70,9 @@ function findItem(items: readonly { id?: string }[], id: string) {
|
70 | 70 | } |
71 | 71 | |
72 | 72 | function expectRecordFields(record: unknown, expected: Record<string, unknown>) { |
73 | | -expect(record).toBeDefined(); |
| 73 | +if (!record || typeof record !== "object") { |
| 74 | +throw new Error("Expected record"); |
| 75 | +} |
74 | 76 | const actual = record as Record<string, unknown>; |
75 | 77 | for (const [key, value] of Object.entries(expected)) { |
76 | 78 | expect(actual[key]).toEqual(value); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。