Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
Publish MCP to npm / Build, test, and publish MCP (push) Waiting to run
Publish SDK to npm / Build, test, and publish SDK (push) Waiting to run
Sync action catalog to docs / sync (push) Waiting to run
Publish UI to npm / Build and publish UI (push) Waiting to run
Build and Release / preflight (push) Waiting to run
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { highwayUploadTimeouts } from '../../src/highway/upload-settings';
|
|
|
|
describe('highway upload timeouts', () => {
|
|
it('retains the idle default and supplies a finite whole-file deadline', () => {
|
|
expect(highwayUploadTimeouts({})).toEqual({ idleMs: 30_000, totalMs: 1_800_000 });
|
|
});
|
|
|
|
it('reads independent millisecond budgets without clamping', () => {
|
|
expect(
|
|
highwayUploadTimeouts({
|
|
SNOWLUMA_HIGHWAY_UPLOAD_IDLE_TIMEOUT_MS: ' 5000 ',
|
|
SNOWLUMA_HIGHWAY_UPLOAD_TIMEOUT_MS: '120000',
|
|
}),
|
|
).toEqual({ idleMs: 5000, totalMs: 120000 });
|
|
expect(highwayUploadTimeouts({ SNOWLUMA_HIGHWAY_UPLOAD_TIMEOUT_MS: '1' }).totalMs).toBe(1);
|
|
expect(
|
|
highwayUploadTimeouts({ SNOWLUMA_HIGHWAY_UPLOAD_TIMEOUT_MS: '2147483647' }).totalMs,
|
|
).toBe(2147483647);
|
|
});
|
|
|
|
it.each(['', ' ', '0', '-1', '1.5', 'NaN', 'Infinity', '1e3', '200ms', '2147483648'])(
|
|
'rejects invalid configuration %j',
|
|
(value) => {
|
|
for (const name of [
|
|
'SNOWLUMA_HIGHWAY_UPLOAD_IDLE_TIMEOUT_MS',
|
|
'SNOWLUMA_HIGHWAY_UPLOAD_TIMEOUT_MS',
|
|
]) {
|
|
expect(() => highwayUploadTimeouts({ [name]: value })).toThrow(name);
|
|
}
|
|
},
|
|
);
|
|
});
|