-
-
Notifications
You must be signed in to change notification settings - Fork 723
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: change project with feature dependencies (#4915)
- Loading branch information
Showing
7 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
...atureSettingsProject/FeatureSettingsProjectConfirm/FeatureSettingsProjectConfirm.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { screen, waitFor } from '@testing-library/react'; | ||
import { render } from 'utils/testRenderer'; | ||
import { testServerRoute, testServerSetup } from 'utils/testServer'; | ||
import FeatureSettingsProjectConfirm from './FeatureSettingsProjectConfirm'; | ||
import { IFeatureToggle } from 'interfaces/featureToggle'; | ||
import { UIProviderContainer } from '../../../../../providers/UIProvider/UIProviderContainer'; | ||
import { Route, Routes } from 'react-router-dom'; | ||
import React from 'react'; | ||
import userEvent from '@testing-library/user-event'; | ||
|
||
const server = testServerSetup(); | ||
|
||
const setupApi = () => { | ||
testServerRoute(server, '/api/admin/ui-config', { | ||
flags: { | ||
dependentFeatures: true, | ||
}, | ||
}); | ||
}; | ||
|
||
test('Cannot change project for feature with dependencies', async () => { | ||
let closed = false; | ||
setupApi(); | ||
render( | ||
<UIProviderContainer> | ||
<Routes> | ||
<Route | ||
path={'projects/:projectId/features/:featureId/settings'} | ||
element={ | ||
<FeatureSettingsProjectConfirm | ||
projectId={'newProjectId'} | ||
feature={ | ||
{ | ||
environments: [], | ||
dependencies: [], | ||
children: ['child'], | ||
} as unknown as IFeatureToggle | ||
} | ||
onClose={() => { | ||
closed = true; | ||
}} | ||
onClick={() => {}} | ||
open={true} | ||
changeRequests={[]} | ||
/> | ||
} | ||
/> | ||
</Routes> | ||
</UIProviderContainer>, | ||
{ | ||
route: 'projects/default/features/parent/settings', | ||
}, | ||
); | ||
|
||
await screen.findByText('Please remove feature dependencies first.'); | ||
|
||
const closeButton = await screen.findByText('Close'); | ||
userEvent.click(closeButton); | ||
|
||
await waitFor(() => { | ||
expect(closed).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5141d9d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
unleash-monorepo-frontend – ./frontend
unleash-monorepo-frontend.vercel.app
unleash-monorepo-frontend-unleash-team.vercel.app
unleash-monorepo-frontend-git-main-unleash-team.vercel.app