test: tighten nullable status assertions · openclaw/openclaw@7ff5e09
steipete
·
2026-05-08
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -14,7 +14,7 @@ describe("createAnthropicPayloadLogger", () => {
|
14 | 14 | flush: async () => undefined, |
15 | 15 | }, |
16 | 16 | }); |
17 | | -expect(logger).not.toBeNull(); |
| 17 | +expect(typeof logger?.wrapStreamFn).toBe("function"); |
18 | 18 | |
19 | 19 | const payload = { |
20 | 20 | messages: [ |
@@ -41,7 +41,11 @@ describe("createAnthropicPayloadLogger", () => {
|
41 | 41 | }) as StreamFn; |
42 | 42 | |
43 | 43 | const wrapped = logger?.wrapStreamFn(streamFn); |
44 | | -await wrapped?.({ api: "anthropic-messages" } as never, { messages: [] } as never, {}); |
| 44 | +expect(typeof wrapped).toBe("function"); |
| 45 | +if (!wrapped) { |
| 46 | +throw new Error("expected payload logger to wrap stream function"); |
| 47 | +} |
| 48 | +await wrapped({ api: "anthropic-messages" } as never, { messages: [] } as never, {}); |
45 | 49 | |
46 | 50 | const event = JSON.parse(lines[0]?.trim() ?? "{}") as Record<string, unknown>; |
47 | 51 | const sanitizedPayload = (event.payload ?? {}) as Record<string, unknown>; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。