fix: complete config path and review follow-ups (#3348)

This commit is contained in:
Bohdan Triapitsyn
2026-09-05 02:19:59 +03:00
committed by GitHub
parent 0543b954c3
commit 260bfe666b
14 changed files with 119 additions and 29 deletions
@@ -99,10 +99,18 @@ describe('OpenCode global config paths', () => {
routes.registerOpenCodeRoutes(app, {});
const response = { json: vi.fn(), status: vi.fn(() => response) };
await handlers.get('GET /api/behavior/agents-md')({}, response);
expect(response.json).toHaveBeenLastCalledWith({
content: '', exists: false, path: path.join(process.env.XDG_CONFIG_HOME, 'opencode', 'AGENTS.md'),
});
await handlers.get('PUT /api/behavior/agents-md')({ body: { content: 'Global behavior' } }, response);
expect(fs.readFileSync(path.join(process.env.XDG_CONFIG_HOME, 'opencode', 'AGENTS.md'), 'utf8')).toBe('Global behavior');
expect(response.json).toHaveBeenCalled();
await handlers.get('GET /api/behavior/agents-md')({}, response);
expect(response.json).toHaveBeenLastCalledWith({
content: 'Global behavior', exists: true, path: path.join(process.env.XDG_CONFIG_HOME, 'opencode', 'AGENTS.md'),
});
fs.rmSync(root, { recursive: true, force: true });
});
});