Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
test: isolate auth in model selector dependent fixtures
fmfsaisai127efe5fd634
diff --git a/apps/desktop/src/renderer/__tests__/modelSelectorTriggerVariant.test.ts b/apps/desktop/src/renderer/__tests__/modelSelectorTriggerVariant.test.tsindex 24cc0cd70a..6a5fc0e57c 100644--- a/apps/desktop/src/renderer/__tests__/modelSelectorTriggerVariant.test.ts+++ b/apps/desktop/src/renderer/__tests__/modelSelectorTriggerVariant.test.ts@@ -11,6 +11,9 @@ const modelSelectorI18nRef = vi.hoisted(() => ({resolvedLanguage: 'zh-CN',}));+// The shared-quota rail observes auth; this component fixture has no auth host.+vi.mock('@/contexts/AuthContext', () => ({ useOptionalAuthUser: () => null }));+vi.mock('react-i18next', async (importOriginal) => ({...(await importOriginal<typeof import('react-i18next')>()),useTranslation: () => ({diff --git a/apps/desktop/src/renderer/components/settings/__tests__/HookWorkspacePrefsEditor.test.tsx b/apps/desktop/src/renderer/components/settings/__tests__/HookWorkspacePrefsEditor.test.tsxindex 3f02302e49..d6a3a694c0 100644--- a/apps/desktop/src/renderer/components/settings/__tests__/HookWorkspacePrefsEditor.test.tsx+++ b/apps/desktop/src/renderer/components/settings/__tests__/HookWorkspacePrefsEditor.test.tsx@@ -6,6 +6,9 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';import type { ProviderPrefsView, SlackHookView } from '../../../../shared/hookControlIpc';import { IM_DEFAULT_SETTINGS } from '../../../../shared/imDefaultSettings';+// The shared-quota rail observes auth; this component fixture has no auth host.+vi.mock('@/contexts/AuthContext', () => ({ useOptionalAuthUser: () => null }));+vi.mock('react-i18next', () => ({useTranslation: () => ({t: (key: string, vars?: { provider?: string }) =>diff --git a/apps/desktop/src/renderer/components/settings/__tests__/VisionBridgeSectionRendering.test.tsx b/apps/desktop/src/renderer/components/settings/__tests__/VisionBridgeSectionRendering.test.tsxindex e944ecbea9..fa0cf98904 100644--- a/apps/desktop/src/renderer/components/settings/__tests__/VisionBridgeSectionRendering.test.tsx+++ b/apps/desktop/src/renderer/components/settings/__tests__/VisionBridgeSectionRendering.test.tsx@@ -23,6 +23,9 @@ class ResizeObserverStub {}(globalThis as { ResizeObserver?: unknown }).ResizeObserver ??= ResizeObserverStub;+// The shared-quota rail observes auth; this component fixture has no auth host.+vi.mock('@/contexts/AuthContext', () => ({ useOptionalAuthUser: () => null }));+vi.mock('react-i18next', () => ({useTranslation: () => ({ t: (key: string) => key }),}));diff --git a/apps/desktop/src/renderer/features/bots/__tests__/botChannelsPage.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/botChannelsPage.test.tsxindex c47421d037..c8e3e9fc7a 100644--- a/apps/desktop/src/renderer/features/bots/__tests__/botChannelsPage.test.tsx+++ b/apps/desktop/src/renderer/features/bots/__tests__/botChannelsPage.test.tsx@@ -13,6 +13,9 @@ const mocks = vi.hoisted(() => ({confirm: vi.fn(async () => true),}));+// The shared-quota rail observes auth; this component fixture has no auth host.+vi.mock('@/contexts/AuthContext', () => ({ useOptionalAuthUser: () => null }));+vi.mock('react-i18next', () => ({useTranslation: () => ({t: (key: string, opts?: Record<string, unknown>) =>diff --git a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginDetailSections.test.tsx b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginDetailSections.test.tsxindex c5536faa31..466cd462aa 100644--- a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginDetailSections.test.tsx+++ b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginDetailSections.test.tsx@@ -41,6 +41,9 @@ vi.mock('@/cindy-brain/GhostSettingsWebview', () => ({),}));+// The shared-quota rail observes auth; this component fixture has no auth host.+vi.mock('@/contexts/AuthContext', () => ({ useOptionalAuthUser: () => null }));+vi.mock('react-i18next', () => ({useTranslation: () => ({t: (key: string, options?: Record<string, unknown>) => {diff --git a/apps/desktop/src/renderer/features/scheduler/components/__tests__/ScheduleChip.test.tsx b/apps/desktop/src/renderer/features/scheduler/components/__tests__/ScheduleChip.test.tsxindex ce9550066b..cfe42e03c2 100644--- a/apps/desktop/src/renderer/features/scheduler/components/__tests__/ScheduleChip.test.tsx+++ b/apps/desktop/src/renderer/features/scheduler/components/__tests__/ScheduleChip.test.tsx@@ -3,6 +3,9 @@ import { useState } from 'react';import { cleanup, fireEvent, render, screen } from '@testing-library/react';import { afterEach, expect, it, vi } from 'vitest';+// The shared-quota rail observes auth; this component fixture has no auth host.+vi.mock('@/contexts/AuthContext', () => ({ useOptionalAuthUser: () => null }));+vi.mock('react-i18next', () => ({useTranslation: () => ({ t: (key: string) => key, i18n: { language: 'en' } }),}));diff --git a/apps/desktop/src/renderer/features/scheduler/components/__tests__/ThreadPickerInline.test.tsx b/apps/desktop/src/renderer/features/scheduler/components/__tests__/ThreadPickerInline.test.tsxindex c28db947f0..c3be1d8814 100644--- a/apps/desktop/src/renderer/features/scheduler/components/__tests__/ThreadPickerInline.test.tsx+++ b/apps/desktop/src/renderer/features/scheduler/components/__tests__/ThreadPickerInline.test.tsx@@ -16,6 +16,9 @@ const mocks = vi.hoisted(() => ({}));vi.mock('@/lib/sessionService', () => ({ list: mocks.list }));+// The shared-quota rail observes auth; this component fixture has no auth host.+vi.mock('@/contexts/AuthContext', () => ({ useOptionalAuthUser: () => null }));+vi.mock('react-i18next', () => ({useTranslation: () => ({ t: (key: string) => key }),}));