Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(test): correct test expectation for tauri command response

Steven Enamakelad8ecd89ba76
diff --git a/app/src/utils/__tests__/tauriCommands.test.ts b/app/src/utils/__tests__/tauriCommands.test.ts
index 21e9398a96..0bd9d490a2 100644
--- a/app/src/utils/__tests__/tauriCommands.test.ts
+++ b/app/src/utils/__tests__/tauriCommands.test.ts
@@ -2,6 +2,7 @@ import { invoke, isTauri } from '@tauri-apps/api/core';
import { afterEach, beforeEach, describe, expect, type Mock, test, vi } from 'vitest';
import { callCoreRpc } from '../../services/coreRpcClient';
+import { storeSessionToken } from '../../services/session/sessionOwner';
vi.mock('@tauri-apps/api/core', () => ({ invoke: vi.fn(), isTauri: vi.fn() }));
vi.mock('../../services/coreRpcClient', () => ({ callCoreRpc: vi.fn() }));
@@ -59,15 +60,15 @@ describe('tauriCommands', () => {
expect(response).toEqual({ is_authenticated: true, user: { id: 'u1' } });
});
- test('storeSession hands the token to the shell session owner on the desktop', async () => {
+ test('storeSession hands the token to the session owner', async () => {
await storeSession('jwt-token', { id: 'u1' });
- // The shell (openhuman-session) validates the JWT and installs it in the
- // core; the renderer never calls a core auth RPC for this.
- expect(mockInvoke).toHaveBeenCalledWith('auth_store_session', {
- token: 'jwt-token',
- user: { id: 'u1' },
- });
+ // The session owner (the shell's `auth_store_session` on the desktop, the
+ // browser equivalent elsewhere — mocked as a whole in `test/setup.ts`)
+ // validates the JWT and installs it in the core; this helper never calls a
+ // core auth RPC or a Tauri command itself.
+ expect(storeSessionToken).toHaveBeenCalledWith('jwt-token', { id: 'u1' });
+ expect(mockInvoke).not.toHaveBeenCalled();
expect(mockCallCoreRpc).not.toHaveBeenCalled();
});