Skip to content

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

TypeScript

test(profile-ui): use the real handoff flag helper (R13-L15)

Josuéfec17bd7db7c
diff --git a/profile-ui/app/components/__tests__/SettingsContent.test.tsx b/profile-ui/app/components/__tests__/SettingsContent.test.tsx
index f489029a1..4293868c8 100644
--- a/profile-ui/app/components/__tests__/SettingsContent.test.tsx
+++ b/profile-ui/app/components/__tests__/SettingsContent.test.tsx
@@ -15,7 +15,6 @@ const mocks = vi.hoisted(() => ({
getConfiguredExternalRestApiBaseUrl: vi.fn(),
getDesktopEnvironment: vi.fn(),
getMe: vi.fn(),
- isDesktopEnvironmentHandoffEnabled: vi.fn(),
isSilentApiError: vi.fn(),
listWorkflowApprovalMediums: vi.fn(),
logout: vi.fn(),
@@ -108,11 +107,14 @@ vi.mock('@lib/approvalChannels', () => ({
listWorkflowApprovalMediums: mocks.listWorkflowApprovalMediums,
}))
-vi.mock('@lib/desktopAppLinks', () => ({
- buildDesktopEnvironmentLink: mocks.buildDesktopEnvironmentLink,
- isDesktopEnvironmentHandoffEnabled: mocks.isDesktopEnvironmentHandoffEnabled,
- navigateToDesktopApp: mocks.navigateToDesktopApp,
-}))
+vi.mock('@lib/desktopAppLinks', async importOriginal => {
+ const actual = await importOriginal<typeof import('@lib/desktopAppLinks')>()
+ return {
+ ...actual,
+ buildDesktopEnvironmentLink: mocks.buildDesktopEnvironmentLink,
+ navigateToDesktopApp: mocks.navigateToDesktopApp,
+ }
+})
vi.mock('@lib/releaseIdentity', () => ({
refreshReleaseIdentity: mocks.refreshReleaseIdentity,
@@ -120,17 +122,20 @@ vi.mock('@lib/releaseIdentity', () => ({
beforeEach(() => {
vi.clearAllMocks()
+ vi.stubEnv('NEXT_PUBLIC_PROFILE_DESKTOP_HANDOFF_ENABLED', 'true')
mocks.buildDesktopEnvironmentLink.mockReturnValue(null)
mocks.getConfiguredExternalRestApiBaseUrl.mockReturnValue('https://api.example.com')
mocks.getDesktopEnvironment.mockResolvedValue(desktopEnvironment)
mocks.getMe.mockResolvedValue(currentUser)
- mocks.isDesktopEnvironmentHandoffEnabled.mockReturnValue(true)
mocks.isSilentApiError.mockReturnValue(false)
mocks.listWorkflowApprovalMediums.mockResolvedValue([])
mocks.refreshApprovalTargets.mockResolvedValue([])
})
-afterEach(cleanup)
+afterEach(() => {
+ cleanup()
+ vi.unstubAllEnvs()
+})
describe('Settings desktop setup handoff', () => {
it('uses the shared desktop environment link builder', async () => {
@@ -156,7 +161,7 @@ describe('Settings desktop setup handoff', () => {
})
it('keeps manual REST setup available while automatic handoff is disabled', async () => {
- mocks.isDesktopEnvironmentHandoffEnabled.mockReturnValue(false)
+ vi.stubEnv('NEXT_PUBLIC_PROFILE_DESKTOP_HANDOFF_ENABLED', 'false')
render(<SettingsContent activeSettingsTab="profile" activeSocialTab="telegram" />)
diff --git a/profile-ui/package-lock.json b/profile-ui/package-lock.json
index 8862324af..143d042e0 100644
--- a/profile-ui/package-lock.json
+++ b/profile-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-profile-ui",
- "version": "0.1.173",
+ "version": "0.1.174",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-profile-ui",
- "version": "0.1.173",
+ "version": "0.1.174",
"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 0e64b9fbd..58e95add1 100644
--- a/profile-ui/package.json
+++ b/profile-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-profile-ui",
- "version": "0.1.173",
+ "version": "0.1.174",
"private": true,
"scripts": {
"dev": "next dev",