Skip to content

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

TypeScript

test(profile-ui): restore desktop handoff flag after use (R13-L14)

Josuédbf8a336c8ab
diff --git a/profile-ui/package-lock.json b/profile-ui/package-lock.json
index 143e1d11b..8862324af 100644
--- a/profile-ui/package-lock.json
+++ b/profile-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-profile-ui",
- "version": "0.1.172",
+ "version": "0.1.173",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-profile-ui",
- "version": "0.1.172",
+ "version": "0.1.173",
"dependencies": {
"@clerum/desktop-app-links": "file:../packages/desktop-app-links",
"@clerum/frontend-components": "file:../packages/frontend-components",
diff --git a/profile-ui/package.json b/profile-ui/package.json
index 10c1e8fff..0e64b9fbd 100644
--- a/profile-ui/package.json
+++ b/profile-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-profile-ui",
- "version": "0.1.172",
+ "version": "0.1.173",
"private": true,
"scripts": {
"dev": "next dev",
diff --git a/profile-ui/test/desktopAppLinks.test.ts b/profile-ui/test/desktopAppLinks.test.ts
index be9750469..3be47788b 100644
--- a/profile-ui/test/desktopAppLinks.test.ts
+++ b/profile-ui/test/desktopAppLinks.test.ts
@@ -8,6 +8,17 @@ import {
navigateToDesktopApp,
} from '../lib/desktopAppLinks'
+function withDesktopHandoffEnabled<T>(run: () => T): T {
+ const original = process.env.NEXT_PUBLIC_PROFILE_DESKTOP_HANDOFF_ENABLED
+ try {
+ process.env.NEXT_PUBLIC_PROFILE_DESKTOP_HANDOFF_ENABLED = 'true'
+ return run()
+ } finally {
+ if (original === undefined) delete process.env.NEXT_PUBLIC_PROFILE_DESKTOP_HANDOFF_ENABLED
+ else process.env.NEXT_PUBLIC_PROFILE_DESKTOP_HANDOFF_ENABLED = original
+ }
+}
+
test('buildDesktopEnvironmentLink is disabled unless the rollout flag is enabled', () => {
const original = process.env.NEXT_PUBLIC_PROFILE_DESKTOP_HANDOFF_ENABLED
const environment = {
@@ -32,29 +43,31 @@ test('buildDesktopEnvironmentLink is disabled unless the rollout flag is enabled
})
test('buildDesktopEnvironmentLink defaults the tenant name to Evenfire', () => {
- process.env.NEXT_PUBLIC_PROFILE_DESKTOP_HANDOFF_ENABLED = 'true'
- const link = buildDesktopEnvironmentLink({
- externalRestApiBaseUrl: 'https://api.example.com',
- rpcProxyBaseUrl: '',
- appName: '',
+ withDesktopHandoffEnabled(() => {
+ const link = buildDesktopEnvironmentLink({
+ externalRestApiBaseUrl: 'https://api.example.com',
+ rpcProxyBaseUrl: '',
+ appName: '',
+ })
+
+ assert.ok(link)
+ const parsedLink = new URL(link)
+ assert.equal(parsedLink.searchParams.get('tenantName'), 'Evenfire')
})
-
- assert.ok(link)
- const parsedLink = new URL(link)
- assert.equal(parsedLink.searchParams.get('tenantName'), 'Evenfire')
})
test('buildDesktopEnvironmentLink does not include the RPC proxy URL', () => {
- process.env.NEXT_PUBLIC_PROFILE_DESKTOP_HANDOFF_ENABLED = 'true'
- const link = buildDesktopEnvironmentLink({
- externalRestApiBaseUrl: 'https://api.example.com',
- rpcProxyBaseUrl: 'https://rpc.example.com',
- appName: 'Example tenant',
+ withDesktopHandoffEnabled(() => {
+ const link = buildDesktopEnvironmentLink({
+ externalRestApiBaseUrl: 'https://api.example.com',
+ rpcProxyBaseUrl: 'https://rpc.example.com',
+ appName: 'Example tenant',
+ })
+
+ assert.ok(link)
+ const parsedLink = new URL(link)
+ assert.equal(parsedLink.searchParams.get('rpcProxyBaseUrl'), null)
})
-
- assert.ok(link)
- const parsedLink = new URL(link)
- assert.equal(parsedLink.searchParams.get('rpcProxyBaseUrl'), null)
})
test('navigateToDesktopApp assigns the protocol URL to the browser location', () => {