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

@@ -102,3 +102,38 @@ describe('channel credential normalization and duplicate checks', () => {
);
});
});
describe('parseDoctorValidationOutput', () => {
it('extracts channel error and warning lines', async () => {
const { parseDoctorValidationOutput } = await import('@electron/utils/channel-config');
const out = parseDoctorValidationOutput(
'feishu',
'feishu error: token invalid\nfeishu warning: fallback enabled\n',
);
expect(out.undetermined).toBe(false);
expect(out.errors).toEqual(['feishu error: token invalid']);
expect(out.warnings).toEqual(['feishu warning: fallback enabled']);
});
it('falls back with hint when output has no channel signal', async () => {
const { parseDoctorValidationOutput } = await import('@electron/utils/channel-config');
const out = parseDoctorValidationOutput('feishu', 'all good, no channel details');
expect(out.undetermined).toBe(true);
expect(out.errors).toEqual([]);
expect(out.warnings.some((w) => w.includes('falling back to local channel config checks'))).toBe(true);
});
it('falls back with hint when output is empty', async () => {
const { parseDoctorValidationOutput } = await import('@electron/utils/channel-config');
const out = parseDoctorValidationOutput('feishu', ' ');
expect(out.undetermined).toBe(true);
expect(out.errors).toEqual([]);
expect(out.warnings.some((w) => w.includes('falling back to local channel config checks'))).toBe(true);
});
});