| 6 | |
| 7 | // Helper: write a temp config file and set CODEBASE_CONTEXT_CONFIG_PATH |
| 8 | async function withTempConfig(content: string, fn: (filePath: string) => Promise<void>) { |
| 9 | const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'ccc-config-test-')); |
| 10 | const filePath = path.join(tmpDir, 'config.json'); |
| 11 | await fs.writeFile(filePath, content, 'utf8'); |
| 12 | try { |
| 13 | await fn(filePath); |
| 14 | } finally { |
| 15 | await fs.rm(tmpDir, { recursive: true, force: true }); |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | describe('loadServerConfig', () => { |
| 20 | afterEach(() => { |