/ src / lib / agent-execute-defaults.test.ts
agent-execute-defaults.test.ts
 1  import assert from 'node:assert/strict'
 2  import test from 'node:test'
 3  import {
 4    DEFAULT_AGENT_EXECUTE_CONFIG,
 5    normalizeAgentExecuteConfig,
 6  } from '@/lib/agent-execute-defaults'
 7  
 8  test('normalizeAgentExecuteConfig defaults to sandbox with network enabled', () => {
 9    const normalized = normalizeAgentExecuteConfig(undefined)
10  
11    assert.equal(normalized.backend, 'sandbox')
12    assert.equal(normalized.network?.enabled, true)
13    assert.equal(normalized.timeout, DEFAULT_AGENT_EXECUTE_CONFIG.timeout)
14  })
15  
16  test('normalizeAgentExecuteConfig preserves explicit host backend and clamps timeout', () => {
17    const normalized = normalizeAgentExecuteConfig({
18      backend: 'host',
19      timeout: 999,
20    })
21  
22    assert.equal(normalized.backend, 'host')
23    assert.equal(normalized.timeout, 300)
24  })