fix: complete config path and review follow-ups (#3348)
This commit is contained in:
committed by
GitHub
parent
0543b954c3
commit
260bfe666b
@@ -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 });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user