From 077130bdb8a534c102749293e741859490f0b3c6 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 16 Feb 2026 07:22:30 +0000 Subject: [PATCH] test: remove overlapping line webhook/account cases --- src/line/accounts.test.ts | 15 ++++----------- src/line/webhook.test.ts | 21 --------------------- 2 files changed, 4 insertions(+), 32 deletions(-) diff --git a/src/line/accounts.test.ts b/src/line/accounts.test.ts index 3330d052391..400fa2d782c 100644 --- a/src/line/accounts.test.ts +++ b/src/line/accounts.test.ts @@ -176,24 +176,17 @@ describe("LINE accounts", () => { }); describe("normalizeAccountId", () => { - it("normalizes undefined to default", () => { + it("normalizes undefined and literal default", () => { expect(normalizeAccountId(undefined)).toBe(DEFAULT_ACCOUNT_ID); - }); - - it("normalizes 'default' to DEFAULT_ACCOUNT_ID", () => { expect(normalizeAccountId("default")).toBe(DEFAULT_ACCOUNT_ID); }); - it("preserves other account ids", () => { + it("preserves non-default account ids", () => { expect(normalizeAccountId("business")).toBe("business"); }); - it("lowercases account ids", () => { - expect(normalizeAccountId("Business")).toBe("business"); - }); - - it("trims whitespace", () => { - expect(normalizeAccountId(" business ")).toBe("business"); + it("trims and lowercases account ids", () => { + expect(normalizeAccountId(" Business ")).toBe("business"); }); }); }); diff --git a/src/line/webhook.test.ts b/src/line/webhook.test.ts index 8707617544d..3c19ee587aa 100644 --- a/src/line/webhook.test.ts +++ b/src/line/webhook.test.ts @@ -139,25 +139,4 @@ describe("createLineWebhookMiddleware", () => { expect(res.json).toHaveBeenCalledWith({ error: "Missing X-Line-Signature header" }); expect(onEvents).not.toHaveBeenCalled(); }); - - it("rejects webhooks with signatures computed using wrong secret", async () => { - const onEvents = vi.fn(async () => {}); - const correctSecret = "correct-secret"; - const wrongSecret = "wrong-secret"; - const rawBody = JSON.stringify({ events: [{ type: "message" }] }); - const middleware = createLineWebhookMiddleware({ channelSecret: correctSecret, onEvents }); - - const req = { - headers: { "x-line-signature": sign(rawBody, wrongSecret) }, - body: rawBody, - // oxlint-disable-next-line typescript/no-explicit-any - } as any; - const res = createRes(); - - // oxlint-disable-next-line typescript/no-explicit-any - await middleware(req, res, {} as any); - - expect(res.status).toHaveBeenCalledWith(401); - expect(onEvents).not.toHaveBeenCalled(); - }); });