mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-16 01:26:07 +00:00
0add63984f
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
18 lines
637 B
TypeScript
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);
|
|
}
|
|
});
|
|
});
|