Skip to content

The agent that grows with you

test(desktop): keep the unscoped getProfiles invariant separate from the scoped one

kshitijk4poor8751b3edd4d9
diff --git a/apps/desktop/src/hermes.test.ts b/apps/desktop/src/hermes.test.ts
index 441190d54a7..bb06f19468f 100644
--- a/apps/desktop/src/hermes.test.ts
+++ b/apps/desktop/src/hermes.test.ts
@@ -30,7 +30,6 @@ import {
setApiRequestConnection,
setApiRequestProfile,
speakText,
- STARTUP_REQUEST_TIMEOUT_MS,
transcribeAudio,
triggerCronJob
} from './hermes'
@@ -179,18 +178,29 @@ describe('Hermes REST helpers', () => {
)
})
- it('pins profile-list reads only when explicitly scoped, without changing unscoped requests', async () => {
- setApiRequestConnection('remote-a')
+ it('does not stamp ambient profile onto unscoped helpers', async () => {
setApiRequestProfile('iris')
await getProfiles()
+
+ expect(api).toHaveBeenCalledWith(
+ expect.objectContaining({
+ path: '/api/profiles'
+ })
+ )
+ expect(api.mock.calls[0][0]).not.toHaveProperty('profile')
+ })
+
+ it('pins the profile list to an explicit (connection, profile) scope', async () => {
+ setApiRequestConnection('remote-a')
+ setApiRequestProfile('iris')
+
await getProfiles({ connectionId: 'remote-b', profile: 'scout' })
await getProfiles({ connectionId: 'local', profile: 'default' })
- expect(api.mock.calls).toEqual([
- [{ connectionId: 'remote-a', path: '/api/profiles', timeoutMs: STARTUP_REQUEST_TIMEOUT_MS }],
- [{ connectionId: 'remote-b', profile: 'scout', path: '/api/profiles', timeoutMs: STARTUP_REQUEST_TIMEOUT_MS }],
- [{ connectionId: 'local', profile: 'default', path: '/api/profiles', timeoutMs: STARTUP_REQUEST_TIMEOUT_MS }]
+ expect(api.mock.calls.map(([request]) => request)).toEqual([
+ expect.objectContaining({ connectionId: 'remote-b', profile: 'scout', path: '/api/profiles' }),
+ expect.objectContaining({ connectionId: 'local', profile: 'default', path: '/api/profiles' })
])
})