chore(rebase): realign duplicate backend/channel/schema files with main
This commit is contained in:
@@ -15,19 +15,6 @@ vi.mock('child_process', () => ({
|
||||
|
||||
const mockExecFile = vi.mocked(execFile);
|
||||
|
||||
function makeFailChild(stderrText = 'failed'): FakeChild {
|
||||
const child = new EventEmitter() as FakeChild;
|
||||
child.stdout = new EventEmitter();
|
||||
child.stderr = new EventEmitter();
|
||||
child.stdin = { end: vi.fn() };
|
||||
child.kill = vi.fn();
|
||||
setImmediate(() => {
|
||||
child.stderr.emit('data', Buffer.from(stderrText));
|
||||
child.emit('close', 1);
|
||||
});
|
||||
return child;
|
||||
}
|
||||
|
||||
describe('ExternalCliBackend', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
@@ -117,25 +104,4 @@ describe('ExternalCliBackend', () => {
|
||||
expect(opencode.name).toBe('opencode');
|
||||
expect(gemini.name).toBe('gemini');
|
||||
});
|
||||
|
||||
it('retries failed backend calls when retries are configured', async () => {
|
||||
spawnMock
|
||||
.mockImplementationOnce(() => makeFailChild('transient'))
|
||||
.mockImplementationOnce(() => makeChild('recovered'));
|
||||
const backend = new ExternalCliBackend({
|
||||
name: 'codex',
|
||||
command: 'codex',
|
||||
retries: 1,
|
||||
retryDelayMs: 0,
|
||||
});
|
||||
|
||||
const result = await backend.process({
|
||||
systemPrompt: 'sys',
|
||||
history: [],
|
||||
message: 'retry me',
|
||||
});
|
||||
|
||||
expect(result).toBe('recovered');
|
||||
expect(spawnMock).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user