test: repair current main extension checks · openclaw/openclaw@67697fa
vincentkoc
·
2026-05-29
·
via Recent Commits to openclaw:main
File tree
slack/src/monitor/message-handler
| Original file line number | Diff line number | Diff line change |
|---|
@@ -102,7 +102,10 @@ function stubSuccessfulSend(name: string) {
|
102 | 102 | return fetchMock; |
103 | 103 | } |
104 | 104 | |
105 | | -async function expectDownloadToRejectForResponse(response: Response, expected = /max bytes/i) { |
| 105 | +async function expectDownloadToRejectForResponse( |
| 106 | +response: Response, |
| 107 | +expected: string | RegExp = /max bytes/i, |
| 108 | +) { |
106 | 109 | vi.stubGlobal("fetch", vi.fn().mockResolvedValue(response)); |
107 | 110 | await expect( |
108 | 111 | downloadGoogleChatMedia({ account, resourceName: "media/123", maxBytes: 10 }), |
@@ -196,7 +199,7 @@ describe("downloadGoogleChatMedia", () => {
|
196 | 199 | "content-type": "application/octet-stream", |
197 | 200 | }), |
198 | 201 | arrayBuffer, |
199 | | -} as Response; |
| 202 | +} as unknown as Response; |
200 | 203 | |
201 | 204 | await expectDownloadToRejectForResponse(response, "invalid content-length header: 0x3"); |
202 | 205 | expect(arrayBuffer).not.toHaveBeenCalled(); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -64,7 +64,7 @@ describe("performMatrixRequest", () => {
|
64 | 64 | status: 200, |
65 | 65 | headers: new Headers({ "content-length": "0x3" }), |
66 | 66 | arrayBuffer, |
67 | | -}) as Response, |
| 67 | +}) as unknown as Response, |
68 | 68 | ), |
69 | 69 | ); |
70 | 70 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -309,9 +309,11 @@ describe("resolveSlackThreadContextData", () => {
|
309 | 309 | allowNameMatching: false, |
310 | 310 | }); |
311 | 311 | |
312 | | -expect(result.threadHistoryBody).toContain("malformed timestamp follow-up"); |
313 | | -expect(result.threadHistoryBody).toContain("[slack message id: 0x65 channel: C123]"); |
314 | | -expect(result.threadHistoryBody).not.toContain("1970-01-01"); |
| 312 | +const malformedHistoryEntry = result.threadHistoryBody |
| 313 | +?.split("\n\n") |
| 314 | +.find((entry) => entry.includes("malformed timestamp follow-up")); |
| 315 | +expect(malformedHistoryEntry).toContain("[slack message id: 0x65 channel: C123]"); |
| 316 | +expect(malformedHistoryEntry).not.toContain("1970-01-01"); |
315 | 317 | }); |
316 | 318 | |
317 | 319 | it("includes self-authored starter (identified by bot user id) for a new thread session (default)", async () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。