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(
shouldEmitDiscordReactionNotification({
...testCase.input,
allowlist: testCase.input.allowlist ? [...testCase.input.allowlist] : undefined,
allowlist:
"allowlist" in testCase.input && testCase.input.allowlist
? [...testCase.input.allowlist]
: undefined,
}),
testCase.name,
).toBe(testCase.expected);

View File

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

View File

@@ -595,16 +595,20 @@ describe("sendMessageTelegram", () => {
fileName: "video.mp4",
});
const opts = {
const opts: Parameters<typeof sendMessageTelegram>[2] = {
token: "tok",
api,
mediaUrl: "https://example.com/video.mp4",
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);