Files
3x-ui/frontend/src/test/setting-sub-updates.test.ts
T
MHSanaei 0add63984f fix(ui): align the subUpdates limit with the backend and show the range
The hand-written settings schema capped subUpdates at 168 while the
backend (and the generated schema mirrored from it) accepts 0-525600.
Anyone upgrading from 2.x with a stored value above 168 could no longer
save any settings tab: the whole settings object is validated on every
save, so the stale field blocked everything with an unexplained
"Invalid input". Match the backend bounds and put them on the input so
the limit is discoverable.

Closes #5821
2026-07-05 20:12:21 +02:00

18 lines
637 B
TypeScript

import { describe, it, expect } from 'vitest';
import { AllSettingSchema } from '@/schemas/setting';
describe('subUpdates range', () => {
it('accepts values the backend allows (gte=0, lte=525600)', () => {
for (const v of [0, 12, 168, 720, 525600]) {
const r = AllSettingSchema.safeParse({ subUpdates: v });
expect(r.success, `subUpdates=${v} should be valid`).toBe(true);
}
});
it('rejects values outside the backend range', () => {
for (const v of [-1, 525601, 1.5]) {
expect(AllSettingSchema.safeParse({ subUpdates: v }).success, `subUpdates=${v} should be invalid`).toBe(false);
}
});
});