Stabilize gateway reload/restart behavior and remove doctor --json dependency (#504)

This commit is contained in:
Lingxuan Zuo
2026-03-16 09:47:04 +08:00
committed by GitHub
Unverified
parent 89bda3c7af
commit 7f3408559d
19 changed files with 843 additions and 62 deletions

View File

@@ -155,4 +155,23 @@ describe('openclaw doctor output handling', () => {
expect(result.stdout).toBe('line-1\nline-2\n');
expect(result.stderr).toBe('warn-1\nwarn-2\n');
});
it('runs plain doctor command without --json', async () => {
const child = new MockUtilityChild();
mockFork.mockReturnValue(child);
const { runOpenClawDoctor } = await import('@electron/utils/openclaw-doctor');
const resultPromise = runOpenClawDoctor();
await vi.waitFor(() => {
expect(mockFork).toHaveBeenCalledTimes(1);
});
child.stdout.emit('data', Buffer.from('doctor ok\n'));
child.emit('exit', 0);
const result = await resultPromise;
expect(result.success).toBe(true);
expect(result.command).toBe('openclaw doctor');
expect(mockFork.mock.calls[0][1]).toEqual(['doctor']);
});
});