test: guard channel record helpers · openclaw/openclaw@c3dba18
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -74,7 +74,9 @@ const policy: ChannelIngressPolicyInput = {
|
74 | 74 | }; |
75 | 75 | |
76 | 76 | function expectRecordFields(record: unknown, expected: Record<string, unknown>) { |
77 | | -expect(record).toBeDefined(); |
| 77 | +if (!record || typeof record !== "object") { |
| 78 | +throw new Error("Expected record"); |
| 79 | +} |
78 | 80 | const actual = record as Record<string, unknown>; |
79 | 81 | for (const [key, value] of Object.entries(expected)) { |
80 | 82 | expect(actual[key]).toEqual(value); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -27,7 +27,9 @@ function pluginIds(plugins: ReturnType<typeof listReadOnlyChannelPluginsForConfi
|
27 | 27 | } |
28 | 28 | |
29 | 29 | function expectRecordFields(record: unknown, expected: Record<string, unknown>) { |
30 | | -expect(record).toBeDefined(); |
| 30 | +if (!record || typeof record !== "object") { |
| 31 | +throw new Error("Expected record"); |
| 32 | +} |
31 | 33 | const actual = record as Record<string, unknown>; |
32 | 34 | for (const [key, value] of Object.entries(expected)) { |
33 | 35 | expect(actual[key]).toEqual(value); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。