test: finish readonly fixture compatibility for CI check

This commit is contained in:
Brian Mendonca
2026-02-21 15:14:37 -07:00
committed by Peter Steinberger
parent c7c047287e
commit 828f4e18e0
3 changed files with 20 additions and 9 deletions

View File

@@ -727,7 +727,10 @@ describe("discord reaction notification gating", () => {
expect( expect(
shouldEmitDiscordReactionNotification({ shouldEmitDiscordReactionNotification({
...testCase.input, ...testCase.input,
allowlist: testCase.input.allowlist ? [...testCase.input.allowlist] : undefined, allowlist:
"allowlist" in testCase.input && testCase.input.allowlist
? [...testCase.input.allowlist]
: undefined,
}), }),
testCase.name, testCase.name,
).toBe(testCase.expected); ).toBe(testCase.expected);

View File

@@ -847,9 +847,13 @@ describe("normalizeOutboundPayloadsForJson", () => {
]; ];
for (const testCase of cases) { for (const testCase of cases) {
expect( const input = testCase.input.map((payload) => {
normalizeOutboundPayloadsForJson(testCase.input.map((payload) => ({ ...payload }))), if ("mediaUrls" in payload && payload.mediaUrls) {
).toEqual(testCase.expected); return { ...payload, mediaUrls: [...payload.mediaUrls] };
}
return { ...payload };
});
expect(normalizeOutboundPayloadsForJson(input)).toEqual(testCase.expected);
} }
}); });
}); });

View File

@@ -595,16 +595,20 @@ describe("sendMessageTelegram", () => {
fileName: "video.mp4", fileName: "video.mp4",
}); });
const opts = { const opts: Parameters<typeof sendMessageTelegram>[2] = {
token: "tok", token: "tok",
api, api,
mediaUrl: "https://example.com/video.mp4", mediaUrl: "https://example.com/video.mp4",
asVideoNote: true, asVideoNote: true,
...testCase.options, ...("replyToMessageId" in testCase.options
? { replyToMessageId: testCase.options.replyToMessageId }
: {}),
...("buttons" in testCase.options
? {
buttons: testCase.options.buttons.map((row) => row.map((button) => ({ ...button }))),
}
: {}),
}; };
if (opts.buttons) {
opts.buttons = opts.buttons.map((row) => [...row]);
}
await sendMessageTelegram(chatId, testCase.text, opts); await sendMessageTelegram(chatId, testCase.text, opts);