From 5681cfd83984d9f2a0447322cd21cdf44e8d1463 Mon Sep 17 00:00:00 2001 From: Shakker Date: Tue, 12 May 2026 17:24:14 +0100 Subject: [PATCH] test: distinguish cron delivery options --- ui/src/ui/views/cron.test.ts | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/ui/src/ui/views/cron.test.ts b/ui/src/ui/views/cron.test.ts index aa09126dbf2..14592f76b4e 100644 --- a/ui/src/ui/views/cron.test.ts +++ b/ui/src/ui/views/cron.test.ts @@ -312,10 +312,17 @@ describe("cron view", () => { container, ); - const options = Array.from(container.querySelectorAll("option")).map((opt) => - (opt.textContent ?? "").trim(), - ); - expect(options).toContain("Webhook POST"); + const deliveryMode = container.querySelector("#cron-delivery-mode"); + expect(Array.from(deliveryMode?.options ?? []).map((opt) => opt.value)).toEqual([ + "announce", + "webhook", + "none", + ]); + expect(Array.from(deliveryMode?.options ?? []).map((opt) => opt.textContent?.trim())).toEqual([ + "Announce summary (default)", + "Webhook POST", + "None (internal)", + ]); render( renderCron( @@ -331,12 +338,16 @@ describe("cron view", () => { container, ); - const normalizedOptions = Array.from(container.querySelectorAll("option")).map((opt) => - (opt.textContent ?? "").trim(), - ); - expect(normalizedOptions).not.toContain("Announce summary (default)"); - expect(normalizedOptions).toContain("Webhook POST"); - expect(normalizedOptions).toContain("None (internal)"); + const normalizedDeliveryMode = + container.querySelector("#cron-delivery-mode"); + expect(normalizedDeliveryMode?.value).toBe("none"); + expect(Array.from(normalizedDeliveryMode?.options ?? []).map((opt) => opt.value)).toEqual([ + "webhook", + "none", + ]); + expect( + Array.from(normalizedDeliveryMode?.options ?? []).map((opt) => opt.textContent?.trim()), + ).toEqual(["Webhook POST", "None (internal)"]); expect(container.querySelector('input[placeholder="https://example.com/cron"]')).toBeNull(); });