From 6f3a6013e3dec4628fd4370f3b40483b844eb539 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 18 Feb 2026 23:27:50 +0000 Subject: [PATCH] test: table-drive poll duration clamp cases --- src/polls.test.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/polls.test.ts b/src/polls.test.ts index b57abfe965c..8d19e132d51 100644 --- a/src/polls.test.ts +++ b/src/polls.test.ts @@ -24,10 +24,14 @@ describe("polls", () => { ).toThrow(/at most 2/); }); - it("clamps poll duration with defaults", () => { - expect(normalizePollDurationHours(undefined, { defaultHours: 24, maxHours: 48 })).toBe(24); - expect(normalizePollDurationHours(999, { defaultHours: 24, maxHours: 48 })).toBe(48); - expect(normalizePollDurationHours(1, { defaultHours: 24, maxHours: 48 })).toBe(1); + it.each([ + { durationHours: undefined, expected: 24 }, + { durationHours: 999, expected: 48 }, + { durationHours: 1, expected: 1 }, + ])("clamps poll duration for $durationHours hours", ({ durationHours, expected }) => { + expect(normalizePollDurationHours(durationHours, { defaultHours: 24, maxHours: 48 })).toBe( + expected, + ); }); it("rejects both durationSeconds and durationHours", () => {