test: clarify msteams attachment url assertions

This commit is contained in:
Peter Steinberger
2026-05-08 08:02:20 +01:00
parent 27fc627f6e
commit 7b5d6cfb92
2 changed files with 8 additions and 3 deletions

View File

@@ -313,7 +313,12 @@ describe("msteams graph attachments", () => {
expectAttachmentMediaLength(media.media, 0);
const calledUrls = fetchMock.mock.calls.map((call) => call[0]);
expect(calledUrls.some((url) => url.startsWith(GRAPH_SHARES_URL_PREFIX))).toBe(true);
expect(calledUrls).toEqual([
DEFAULT_MESSAGE_URL,
expect.stringContaining(GRAPH_SHARES_URL_PREFIX),
`${DEFAULT_MESSAGE_URL}/hostedContents`,
expect.stringContaining(GRAPH_SHARES_URL_PREFIX),
]);
expect(calledUrls).not.toContain(escapedUrl);
});

View File

@@ -638,8 +638,8 @@ describe("msteams attachments", () => {
return resolveRequestUrl(input);
});
// Should have hit the original host, NOT graph shares.
expect(calledUrls.some((url) => url === directUrl)).toBe(true);
expect(calledUrls.some((url) => url.startsWith(GRAPH_SHARES_URL_PREFIX))).toBe(false);
expect(calledUrls).toContain(directUrl);
expect(calledUrls.filter((url) => url.startsWith(GRAPH_SHARES_URL_PREFIX))).toEqual([]);
});
});