Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(desktop): r3-l4 pin exact origin matching

Josué0c22acb3460f
diff --git a/desktop-app/ui/src/hooks/domain/__tests__/desktopEnvironmentHandoff.test.ts b/desktop-app/ui/src/hooks/domain/__tests__/desktopEnvironmentHandoff.test.ts
index e0cdb2766..e216f5253 100644
--- a/desktop-app/ui/src/hooks/domain/__tests__/desktopEnvironmentHandoff.test.ts
+++ b/desktop-app/ui/src/hooks/domain/__tests__/desktopEnvironmentHandoff.test.ts
@@ -143,3 +143,42 @@ describe('Desktop environment handoff concurrency', () => {
)
})
})
+
+describe('Desktop environment origin matching', () => {
+ it.each([
+ [
+ 'a REST host suffix',
+ {
+ ...targetEnvironment,
+ externalRestApiBaseUrl: 'https://api.example.test.evil.tld',
+ },
+ ],
+ [
+ 'a different REST port',
+ {
+ ...targetEnvironment,
+ externalRestApiBaseUrl: 'https://api.example.test:8443',
+ },
+ ],
+ [
+ 'a downgraded REST scheme',
+ {
+ ...targetEnvironment,
+ externalRestApiBaseUrl: 'http://api.example.test',
+ },
+ ],
+ ['a missing RPC endpoint', { ...targetEnvironment, rpcProxyBaseUrl: '' }],
+ ])('does not switch to a saved environment with %s', async (_case, linkedEnvironment) => {
+ const { handler, selectRuntimeConfig, setPendingDesktopEnvironmentSetup } = createHandler(
+ () => ({ booting: false, busy: false, authTransitioning: false, isAuthenticated: false })
+ )
+
+ await handler(linkedEnvironment)
+
+ expect(selectRuntimeConfig).not.toHaveBeenCalled()
+ expect(setPendingDesktopEnvironmentSetup).toHaveBeenCalledWith({
+ ...linkedEnvironment,
+ rpcProxyBaseUrl: '',
+ })
+ })
+})