Skip to content

Commit c0470a2

Browse files
committed
test(line): fail unexpected media downloads
1 parent d3729c1 commit c0470a2

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

extensions/line/src/bot-handlers.test.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,8 @@ describe("handleLineWebhookEvents", () => {
350350
upsertPairingRequestMock.mockReset();
351351
upsertPairingRequestMock.mockImplementation(async () => ({ code: "CODE", created: true }));
352352
downloadLineMediaMock.mockReset();
353-
downloadLineMediaMock.mockResolvedValue({
354-
path: "/tmp/line-media/voice-note.m4a",
355-
contentType: "audio/x-m4a",
356-
size: 1234,
353+
downloadLineMediaMock.mockImplementation(async () => {
354+
throw new Error("downloadLineMedia should not be called from bot-handlers tests");
357355
});
358356
});
359357
it("blocks group messages when groupPolicy is disabled", async () => {
@@ -1013,6 +1011,11 @@ describe("handleLineWebhookEvents", () => {
10131011

10141012
it("forwards LINE file names to media downloads", async () => {
10151013
const processMessage = vi.fn();
1014+
downloadLineMediaMock.mockResolvedValueOnce({
1015+
path: "/tmp/line-media/voice-note.m4a",
1016+
contentType: "audio/x-m4a",
1017+
size: 1234,
1018+
});
10161019
const event = createTestMessageEvent({
10171020
message: {
10181021
id: "file-audio-1",

0 commit comments

Comments
 (0)