The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test: add missing test files for settings and onboarding components
Steven Enamakel10ef25059f64
diff --git a/app/src/components/settings/oauth/__tests__/OpenAiOAuthConnect.test.tsx b/app/src/components/settings/oauth/__tests__/OpenAiOAuthConnect.test.tsxindex f85b3d0fe4..4bde65d087 100644--- a/app/src/components/settings/oauth/__tests__/OpenAiOAuthConnect.test.tsx+++ b/app/src/components/settings/oauth/__tests__/OpenAiOAuthConnect.test.tsx@@ -163,18 +163,22 @@ describe('OpenAiOAuthConnect', () => {expect(screen.queryByTestId(`${TID}-connect`)).not.toBeInTheDocument();});- it('blocks sign-in outside the desktop app', async () => {+ it('starts sign-in over core RPC outside the desktop app', async () => {vi.mocked(isTauri).mockReturnValue(false);+ vi.mocked(callCoreRpc)+ .mockResolvedValueOnce({ result: { connected: false } }) // status+ .mockResolvedValueOnce({ result: { authUrl: 'https://auth.openai.com/oauth?x=1' } }); // startrenderWithProviders(<OpenAiOAuthConnect testIdPrefix={TID} />);fireEvent.click(await screen.findByTestId(`${TID}-connect`));- expect(await screen.findByTestId(`${TID}-error`)).toHaveTextContent(- 'ChatGPT sign-in is only available in the desktop app.'+ await waitFor(() =>+ expect(callCoreRpc).toHaveBeenCalledWith(+ expect.objectContaining({ method: 'openhuman.inference_openai_oauth_start' })+ ));- // No RPC should have been attempted (status probe also short-circuits off-desktop).- expect(callCoreRpc).not.toHaveBeenCalled();+ expect(screen.queryByTestId(`${TID}-error`)).not.toBeInTheDocument();});it('requires a callback URL before completing', async () => {diff --git a/app/src/components/settings/panels/__tests__/AgentAccessPanel.test.tsx b/app/src/components/settings/panels/__tests__/AgentAccessPanel.test.tsxindex a8840eb5a1..4dcfb8c438 100644--- a/app/src/components/settings/panels/__tests__/AgentAccessPanel.test.tsx+++ b/app/src/components/settings/panels/__tests__/AgentAccessPanel.test.tsx@@ -175,14 +175,14 @@ describe('AgentAccessPanel (advanced)', () => {expect(await screen.findByText('boom')).toBeInTheDocument();});- it('shows the desktop-only notice and skips loading off-Tauri', async () => {+ it('loads settings over core RPC off-Tauri without a desktop-only notice', async () => {vi.mocked(isTauri).mockReturnValue(false);renderWithProviders(<AgentAccessPanel />);+ await waitFor(() => expect(mockGet).toHaveBeenCalled());+ expect(mockGetAgent).toHaveBeenCalled();expect(- await screen.findByText('Access settings are only available in the desktop app.')- ).toBeInTheDocument();- expect(mockGet).not.toHaveBeenCalled();- expect(mockGetAgent).not.toHaveBeenCalled();+ screen.queryByText('Access settings are only available in the desktop app.')+ ).not.toBeInTheDocument();});it('loads the configured action timeout into the input', async () => {diff --git a/app/src/components/settings/panels/__tests__/PermissionsPanel.test.tsx b/app/src/components/settings/panels/__tests__/PermissionsPanel.test.tsxindex 0581daf2c0..af250a043e 100644--- a/app/src/components/settings/panels/__tests__/PermissionsPanel.test.tsx+++ b/app/src/components/settings/panels/__tests__/PermissionsPanel.test.tsx@@ -198,14 +198,14 @@ describe('PermissionsPanel', () => {expect(screen.getByTestId('permissions-action-dir-env-locked')).toBeInTheDocument();});- it('shows the desktop-only notice and skips loading off-Tauri', async () => {+ it('loads settings over core RPC off-Tauri without a desktop-only notice', async () => {vi.mocked(isTauri).mockReturnValue(false);renderWithProviders(<PermissionsPanel />);+ await waitFor(() => expect(mockGet).toHaveBeenCalled());+ expect(mockGetPaths).toHaveBeenCalled();expect(- await screen.findByText('Access settings are only available in the desktop app.')- ).toBeInTheDocument();- expect(mockGet).not.toHaveBeenCalled();- expect(mockGetPaths).not.toHaveBeenCalled();+ screen.queryByText('Access settings are only available in the desktop app.')+ ).not.toBeInTheDocument();});it('surfaces a load error without crashing', async () => {diff --git a/app/src/pages/onboarding/steps/__tests__/ApiKeysStep.test.tsx b/app/src/pages/onboarding/steps/__tests__/ApiKeysStep.test.tsxindex 31fb03dc33..2171105052 100644--- a/app/src/pages/onboarding/steps/__tests__/ApiKeysStep.test.tsx+++ b/app/src/pages/onboarding/steps/__tests__/ApiKeysStep.test.tsx@@ -75,18 +75,24 @@ describe('ApiKeysStep OpenAI OAuth', () => {expect(await screen.findByTestId('onboarding-openai-oauth-connected')).toBeInTheDocument();});- it('shows a desktop-only error without calling core outside Tauri', async () => {+ it('starts OAuth over core RPC outside Tauri', async () => {vi.mocked(isTauri).mockReturnValue(false);+ vi.mocked(callCoreRpc).mockImplementation(async ({ method }: { method: string }) =>+ method === 'openhuman.inference_openai_oauth_start'+ ? { result: { authUrl: 'https://auth.openai.com/oauth?x=1' } }+ : { result: { connected: false } }+ );renderWithProviders(<ApiKeysStep onNext={vi.fn()} onSkip={vi.fn()} />);fireEvent.click(screen.getByTestId('onboarding-openai-oauth-connect'));+ await waitFor(() =>+ expect(openUrl).toHaveBeenCalledWith('https://auth.openai.com/oauth?x=1')+ );expect(- await screen.findByText('ChatGPT sign-in is only available in the desktop app.')- ).toBeInTheDocument();- expect(callCoreRpc).not.toHaveBeenCalled();- expect(openUrl).not.toHaveBeenCalled();+ screen.queryByText('ChatGPT sign-in is only available in the desktop app.')+ ).not.toBeInTheDocument();});it('reports an oauth start failure when core omits authUrl', async () => {diff --git a/app/src/services/api/__tests__/aiSettingsApi.test.ts b/app/src/services/api/__tests__/aiSettingsApi.test.tsindex f33d0e0d7b..970b3720c1 100644--- a/app/src/services/api/__tests__/aiSettingsApi.test.ts+++ b/app/src/services/api/__tests__/aiSettingsApi.test.ts@@ -1017,13 +1017,14 @@ describe('testProviderModel', () => {expect(result).toEqual({ reply: 'Hello from model' });});- it('throws when not running in Tauri', async () => {+ it('calls core RPC when not running in Tauri', async () => {mockIsTauri.mockReturnValue(false);+ mockCallCoreRpc.mockResolvedValueOnce({ result: { reply: 'Hello from model' } });- await expect(testProviderModel('reasoning', 'openai:gpt-4o')).rejects.toThrow(- 'Model testing is only available in the desktop app.'- );- expect(mockCallCoreRpc).not.toHaveBeenCalled();+ await expect(testProviderModel('reasoning', 'openai:gpt-4o')).resolves.toEqual({+ reply: 'Hello from model',+ });+ expect(mockCallCoreRpc).toHaveBeenCalled();});});