import { describe, expect, it } from 'vitest' import type { Config } from '@deepseek-ai/dsh-pty-local/src/config.ts' import { validateConfig } from '@deepseek-ai/dsh-pty-local/src/config.ts' function config(overrides: Partial = {}): Config { return { backendType: 'shell', shellPath: '/bin/bash', shellArgs: [], rows: 40, cols: 160, scrollbackLines: 100, scrollbackMaxBytes: 1024, maxReadBytes: 512, pollIntervalMs: 10, exactProbeAfterMs: 20, idleSilenceMs: 100, timeoutMs: 1000, disposeGraceMs: 100, ...overrides, } } describe('pty-local config', () => { it('accepts resolved positive bounds', () => { expect(() => { validateConfig(config()) }).not.toThrow() }) it('rejects empty names, invalid numbers, and a read cap above retention', () => { expect(() => { validateConfig(config({ backendType: '' })) }).toThrow('backendType') expect(() => { validateConfig(config({ shellPath: '' })) }).toThrow('shellPath') expect(() => { validateConfig(config({ rows: 0 })) }).toThrow('rows') expect(() => { validateConfig(config({ rows: 1.5 })) }).toThrow('rows') expect(() => { validateConfig(config({ maxReadBytes: 2048 })) }).toThrow('must not exceed') }) })