Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
test(desktop): 补齐认证恢复测试的版本启动依赖
ficowang302a734be308
diff --git a/apps/desktop/src/main/__tests__/authCredentialRecoveryWiring.test.ts b/apps/desktop/src/main/__tests__/authCredentialRecoveryWiring.test.tsindex 383133e2cc..4008237501 100644--- a/apps/desktop/src/main/__tests__/authCredentialRecoveryWiring.test.ts+++ b/apps/desktop/src/main/__tests__/authCredentialRecoveryWiring.test.ts@@ -20,9 +20,14 @@ describe('production credential recovery wiring', () => {expect(wiring).toContain('app.quit()');});- it.each([false, true])(- 'requests recovery when initialization rejects=%s without replacing its outcome',- async (rejects) => {+ it.each([+ { rejects: false, versionLaunchPending: false },+ { rejects: false, versionLaunchPending: true },+ { rejects: true, versionLaunchPending: false },+ { rejects: true, versionLaunchPending: true },+ ])(+ 'requests recovery when initialization rejects=$rejects and versionLaunchPending=$versionLaunchPending without replacing its outcome',+ async ({ rejects, versionLaunchPending }) => {const start = bootstrap.indexOf("ipcMain.handle('auth:initialize',");const end = bootstrap.indexOf("ipcMain.handle('auth:get-login-state',", start);expect(start).toBeGreaterThan(-1);@@ -33,6 +38,8 @@ describe('production credential recovery wiring', () => {let handler!: () => Promise<unknown>;const outcome = rejects ? new Error('owner teardown failed') : { isAuthenticated: false };const request = vi.fn();+ const recordStartupResult = vi.fn();+ const getAuthState = vi.fn(() => outcome);const deps = {ipcMain: {handle: (_channel: string, callback: typeof handler) => {@@ -42,15 +49,30 @@ describe('production credential recovery wiring', () => {authManager: {initialize: () => (rejects ? Promise.reject(outcome) : Promise.resolve(outcome)),ensureStableOwnerPostCommitTasks: vi.fn(async () => {}),+ getAuthState,},authCredentialRecovery: { request },app: { isPackaged: true },+ isCindyVersionLaunchPending: vi.fn(() => versionLaunchPending),+ recordDesktopDevAuthStartupResult: recordStartupResult,noteAuthColdStartState: vi.fn(),};new Function(...Object.keys(deps), compiled)(...Object.values(deps));if (rejects) await expect(handler()).rejects.toBe(outcome);else await expect(handler()).resolves.toBe(outcome);expect(request).toHaveBeenCalledTimes(1);+ if (!rejects && versionLaunchPending) {+ expect(recordStartupResult).toHaveBeenCalledExactlyOnceWith(+ outcome,+ null,+ expect.any(Function),+ );+ expect(recordStartupResult.mock.calls[0][2]()).toBe(outcome);+ expect(getAuthState).toHaveBeenCalledTimes(1);+ } else {+ expect(recordStartupResult).not.toHaveBeenCalled();+ expect(getAuthState).not.toHaveBeenCalled();+ }},);