test: repair current main extension checks

This commit is contained in:
Vincent Koc
2026-05-29 15:36:11 +02:00
parent d9db23dc2f
commit 67697fa309
3 changed files with 11 additions and 6 deletions

View File

@@ -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();

View File

@@ -64,7 +64,7 @@ describe("performMatrixRequest", () => {
status: 200,
headers: new Headers({ "content-length": "0x3" }),
arrayBuffer,
}) as Response,
}) as unknown as Response,
),
);

View File

@@ -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 () => {