test: tighten discord api request assertion · openclaw/openclaw@6451000
shakkernerd
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -142,8 +142,12 @@ describe("fetchDiscord", () => {
|
142 | 142 | }); |
143 | 143 | |
144 | 144 | expect(result).toEqual({ id: "42" }); |
145 | | -expect(request?.method).toBe("POST"); |
146 | | -expect(request?.body).toBe(JSON.stringify({ content: "hello" })); |
147 | | -expect(new Headers(request?.headers).get("content-type")).toBe("application/json"); |
| 145 | +expect(request).toBeDefined(); |
| 146 | +if (!request) { |
| 147 | +throw new Error("expected Discord request init"); |
| 148 | +} |
| 149 | +expect(request.method).toBe("POST"); |
| 150 | +expect(request.body).toBe(JSON.stringify({ content: "hello" })); |
| 151 | +expect(new Headers(request.headers).get("content-type")).toBe("application/json"); |
148 | 152 | }); |
149 | 153 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。