mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 21:14:31 +00:00
test: table-drive poll duration clamp cases
This commit is contained in:
@@ -24,10 +24,14 @@ describe("polls", () => {
|
|||||||
).toThrow(/at most 2/);
|
).toThrow(/at most 2/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("clamps poll duration with defaults", () => {
|
it.each([
|
||||||
expect(normalizePollDurationHours(undefined, { defaultHours: 24, maxHours: 48 })).toBe(24);
|
{ durationHours: undefined, expected: 24 },
|
||||||
expect(normalizePollDurationHours(999, { defaultHours: 24, maxHours: 48 })).toBe(48);
|
{ durationHours: 999, expected: 48 },
|
||||||
expect(normalizePollDurationHours(1, { defaultHours: 24, maxHours: 48 })).toBe(1);
|
{ 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", () => {
|
it("rejects both durationSeconds and durationHours", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user