Files
stack/packages/model-proxy/tests/p2-settings.test.mjs
jason.woltje 362893d043 feat: integrate reviewed proxy page and managed model keys
Source-candidate: poe d9a564e6d20f5f0fd75ce45b12cbbf8bb4c9d568\nSource-candidate: magica38ba5762b06716db1dee00d0afec162656488f5c\nValidated321whole-file phase plus whole bus1349/model-proxy100/webui490; final gate tooling checks pending, not landed.
2026-10-26 12:04:21 -05:00

16 lines
1.0 KiB
JavaScript

// 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);
});
}