// P2 named settings refuse independently; legacy sidecars retain their shape. import test from 'node:test'; import assert from 'node:assert/strict'; import { validateProxy, installPaths } from '../src/settings.mjs'; const dataRoot = '/fixture-data'; const base = { port: 18432, binary: installPaths(dataRoot).binary }; test('proxy settings without optional timing fields remain valid', () => assert.deepEqual(validateProxy(base, dataRoot), base)); test('proxy settings accept each positive upper bound', () => { assert.deepEqual(validateProxy({ ...base, rotateGraceMinutes: 1440, firstOutputSeconds: 3600 }, dataRoot), { ...base, rotateGraceMinutes: 1440, firstOutputSeconds: 3600 }); }); for (const [field, maximum, code] of [['rotateGraceMinutes', 1440, 'proxy-rotate-grace-invalid'], ['firstOutputSeconds', 3600, 'proxy-first-output-invalid']]) { for (const value of [0, -1, maximum + 1, 1.5, '120', null]) test(`${code}: ${JSON.stringify(value)}`, () => { assert.throws(() => validateProxy({ ...base, [field]: value }, dataRoot), e => e.code === code); }); }