收口 Makelore 客户端变更
Some checks failed
Electron E2E / Electron E2E (macos-latest) (push) Has been cancelled
Electron E2E / Electron E2E (ubuntu-latest) (push) Has been cancelled
Electron E2E / Electron E2E (windows-latest) (push) Has been cancelled

This commit is contained in:
inman
2026-08-12 22:35:06 +08:00
parent 253bad8b40
commit f4113a872f
232 changed files with 4617 additions and 20121 deletions

View File

@@ -187,6 +187,31 @@ describe('auth host api routes', () => {
expect(JSON.stringify(response.json())).not.toContain('app:app');
});
it('replaces an upstream HTML gateway error with a concise browser-login message', async () => {
const fetchMock = vi.fn().mockResolvedValueOnce(
new Response(
'<html><head><title>502 Bad Gateway</title></head><body>upstream details</body></html>',
{ status: 502, headers: { 'content-type': 'text/html' } },
),
);
vi.stubGlobal('fetch', fetchMock);
const response = createResponse();
await handleAuthRoutes(
createRequest('POST'),
response.res,
new URL('http://127.0.0.1:13210/api/auth/browser/start'),
{} as never,
);
expect(response.statusCode).toBe(502);
expect(response.json()).toEqual({
success: false,
error: '登录服务暂时不可用,请稍后重试。',
});
expect(JSON.stringify(response.json())).not.toContain('<html>');
});
it('opens Works Square browser authorization and returns the approved desktop token', async () => {
const fetchMock = vi.fn()
.mockResolvedValueOnce(