mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 06:52:53 +00:00
test: repair current main extension checks
This commit is contained in:
@@ -102,7 +102,10 @@ function stubSuccessfulSend(name: string) {
|
||||
return fetchMock;
|
||||
}
|
||||
|
||||
async function expectDownloadToRejectForResponse(response: Response, expected = /max bytes/i) {
|
||||
async function expectDownloadToRejectForResponse(
|
||||
response: Response,
|
||||
expected: string | RegExp = /max bytes/i,
|
||||
) {
|
||||
vi.stubGlobal("fetch", vi.fn().mockResolvedValue(response));
|
||||
await expect(
|
||||
downloadGoogleChatMedia({ account, resourceName: "media/123", maxBytes: 10 }),
|
||||
@@ -196,7 +199,7 @@ describe("downloadGoogleChatMedia", () => {
|
||||
"content-type": "application/octet-stream",
|
||||
}),
|
||||
arrayBuffer,
|
||||
} as Response;
|
||||
} as unknown as Response;
|
||||
|
||||
await expectDownloadToRejectForResponse(response, "invalid content-length header: 0x3");
|
||||
expect(arrayBuffer).not.toHaveBeenCalled();
|
||||
|
||||
@@ -64,7 +64,7 @@ describe("performMatrixRequest", () => {
|
||||
status: 200,
|
||||
headers: new Headers({ "content-length": "0x3" }),
|
||||
arrayBuffer,
|
||||
}) as Response,
|
||||
}) as unknown as Response,
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -309,9 +309,11 @@ describe("resolveSlackThreadContextData", () => {
|
||||
allowNameMatching: false,
|
||||
});
|
||||
|
||||
expect(result.threadHistoryBody).toContain("malformed timestamp follow-up");
|
||||
expect(result.threadHistoryBody).toContain("[slack message id: 0x65 channel: C123]");
|
||||
expect(result.threadHistoryBody).not.toContain("1970-01-01");
|
||||
const malformedHistoryEntry = result.threadHistoryBody
|
||||
?.split("\n\n")
|
||||
.find((entry) => entry.includes("malformed timestamp follow-up"));
|
||||
expect(malformedHistoryEntry).toContain("[slack message id: 0x65 channel: C123]");
|
||||
expect(malformedHistoryEntry).not.toContain("1970-01-01");
|
||||
});
|
||||
|
||||
it("includes self-authored starter (identified by bot user id) for a new thread session (default)", async () => {
|
||||
|
||||
Reference in New Issue
Block a user