address audit findings: schedule validation, settings json guard, pipeline types, a11y labels
Build and Push Docker Image / build (push) Successful in 58s
Build and Push Docker Image / build (push) Successful in 58s
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { updateScheduleConfig } from "../scheduler";
|
||||
|
||||
// These tests only exercise the pure validation path in updateScheduleConfig —
|
||||
// invalid payloads must throw before any setConfig() call, so they never touch
|
||||
// the DB. Valid payloads would hit the DB, so we don't exercise them here.
|
||||
describe("updateScheduleConfig validation", () => {
|
||||
test("rejects malformed HH:MM start/end", () => {
|
||||
expect(() => updateScheduleConfig({ scan: { enabled: true, start: "xx:yy", end: "07:00" } })).toThrow();
|
||||
expect(() => updateScheduleConfig({ scan: { enabled: true, start: "1:00", end: "07:00" } })).toThrow();
|
||||
expect(() => updateScheduleConfig({ scan: { enabled: true, start: "24:00", end: "07:00" } })).toThrow();
|
||||
expect(() => updateScheduleConfig({ process: { enabled: true, start: "01:00", end: "99:99" } })).toThrow();
|
||||
});
|
||||
|
||||
test("rejects non-integer, negative, or out-of-bounds job_sleep_seconds", () => {
|
||||
expect(() => updateScheduleConfig({ job_sleep_seconds: Number.NaN })).toThrow();
|
||||
expect(() => updateScheduleConfig({ job_sleep_seconds: -1 })).toThrow();
|
||||
expect(() => updateScheduleConfig({ job_sleep_seconds: 1.5 })).toThrow();
|
||||
expect(() => updateScheduleConfig({ job_sleep_seconds: 86_401 })).toThrow();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user