Skip to content

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

test(utils): add unit and e2e tests for tauri commands and core bridge

Steven Enamakelfd7e08693119
diff --git a/app/src/utils/__tests__/tauriCommands.test.ts b/app/src/utils/__tests__/tauriCommands.test.ts
index 0bd9d490a2..b437f98743 100644
--- a/app/src/utils/__tests__/tauriCommands.test.ts
+++ b/app/src/utils/__tests__/tauriCommands.test.ts
@@ -119,10 +119,12 @@ describe('tauriCommands', () => {
);
});
- test('openhumanServiceStatus throws when not running in Tauri', async () => {
+ test('openhumanServiceStatus uses core RPC and skips the CLI fallback outside Tauri', async () => {
mockIsTauri.mockReturnValue(false);
+ mockCallCoreRpc.mockRejectedValueOnce(new Error('core unreachable'));
- await expect(openhumanServiceStatus()).rejects.toThrow('Not running in Tauri');
- expect(mockCallCoreRpc).not.toHaveBeenCalled();
+ await expect(openhumanServiceStatus()).rejects.toThrow('core unreachable');
+ expect(mockCallCoreRpc).toHaveBeenCalledWith({ method: 'openhuman.service_status' });
+ expect(mockInvoke).not.toHaveBeenCalled();
});
});
diff --git a/app/src/utils/__tests__/tauriCoreBridge.e2e.test.ts b/app/src/utils/__tests__/tauriCoreBridge.e2e.test.ts
index 7d5442632f..7d37509266 100644
--- a/app/src/utils/__tests__/tauriCoreBridge.e2e.test.ts
+++ b/app/src/utils/__tests__/tauriCoreBridge.e2e.test.ts
@@ -49,10 +49,19 @@ describe('Web → frontend JSON-RPC → Core bridge', () => {
expect(response.result.url).toContain('127.0.0.1');
});
- test('fails fast in web-only mode without Tauri runtime', async () => {
+ test('routes service status via JSON-RPC in web-only mode without Tauri runtime', async () => {
mockIsTauri.mockReturnValue(false);
+ const rpcResponse = { result: { state: 'Running' as ServiceState }, logs: [] };
+ mockCallCoreRpc.mockResolvedValueOnce(rpcResponse);
+
+ await expect(openhumanServiceStatus()).resolves.toEqual(rpcResponse);
+ expect(mockCallCoreRpc).toHaveBeenCalledWith({ method: 'openhuman.service_status' });
+ });
+
+ test('surfaces the RPC error without the Tauri CLI fallback in web-only mode', async () => {
+ mockIsTauri.mockReturnValue(false);
+ mockCallCoreRpc.mockRejectedValueOnce(new Error('core unreachable'));
- await expect(openhumanServiceStatus()).rejects.toThrow('Not running in Tauri');
- expect(mockCallCoreRpc).not.toHaveBeenCalled();
+ await expect(openhumanServiceStatus()).rejects.toThrow('core unreachable');
});
});