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(core-mode): add gateway-mode tests for synchronous recovery and id-only storage
Steven Enamakel97b5257d1344
diff --git a/app/src/store/coreModeSlice.test.ts b/app/src/store/coreModeSlice.test.tsindex a4e14644bd..193a72209d 100644--- a/app/src/store/coreModeSlice.test.ts+++ b/app/src/store/coreModeSlice.test.ts@@ -162,3 +162,51 @@ describe('coreModeSlice — sync-localStorage-derived initial state', () => {expect(next.mode).toEqual({ kind: 'local' });});});++describe('coreModeSlice — gateway mode', () => {+ async function freshImportWith(entries: Record<string, string>) {+ localStorage.clear();+ for (const [k, v] of Object.entries(entries)) localStorage.setItem(k, v);+ vi.resetModules();+ return import('./coreModeSlice');+ }++ it('recovers the chosen gateway synchronously on reload', async () => {+ // redux-persist flushes asynchronously, so a reload can beat it. Without+ // the synchronous marker the app would fall back to the picker after every+ // restart even though the user had chosen a gateway.+ const mod = await freshImportWith({+ openhuman_core_mode: 'gateway',+ openhuman_core_gateway_id: 'builder',+ });++ const state = mod.default(undefined, { type: '@@INIT' });+ expect(state.mode).toEqual({ kind: 'gateway', gatewayId: 'builder' });+ });++ it('falls through to unset when the id is missing', async () => {+ // There is nothing to activate, so asking again beats failing later.+ const mod = await freshImportWith({ openhuman_core_mode: 'gateway' });++ expect(mod.default(undefined, { type: '@@INIT' }).mode).toEqual({ kind: 'unset' });+ });++ it('stores only an id, never a spec or a credential', async () => {+ const mod = await freshImportWith({+ openhuman_core_mode: 'gateway',+ openhuman_core_gateway_id: 'builder',+ });+ const state = mod.default(undefined, mod.setCoreMode({ kind: 'gateway', gatewayId: 'builder' }));++ expect(Object.keys(state.mode)).toEqual(['kind', 'gatewayId']);+ });++ it('switching away from a gateway replaces the mode outright', async () => {+ const mod = await freshImportWith({});+ const asGateway = mod.default(undefined, mod.setCoreMode({ kind: 'gateway', gatewayId: 'b' }));++ expect(mod.default(asGateway, mod.setCoreMode({ kind: 'local' })).mode).toEqual({+ kind: 'local',+ });+ });+});