mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-28 17:55:15 +02:00
Adds a Biome rule for "no unused imports", which is something we sometimes have trouble catching. We're adding this as a warning for now. It is safely and easily fixable with `yarn lint:fix`.  
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import { render } from 'utils/testRenderer';
|
|
import { screen } from '@testing-library/react';
|
|
import { testServerRoute, testServerSetup } from 'utils/testServer';
|
|
import { ContextFieldUsage } from './ContextFieldUsage';
|
|
|
|
const server = testServerSetup();
|
|
const contextFieldName = 'appName';
|
|
|
|
const setupRoutes = () => {
|
|
testServerRoute(
|
|
server,
|
|
`api/admin/context/${contextFieldName}/strategies`,
|
|
{
|
|
strategies: [
|
|
{
|
|
id: '4b3ad603-4727-4782-bd61-efc530e37209',
|
|
projectId: 'faaa',
|
|
featureName: 'tests',
|
|
strategyName: 'flexibleRollout',
|
|
environment: 'development',
|
|
},
|
|
],
|
|
},
|
|
);
|
|
testServerRoute(server, '/api/admin/projects', {
|
|
version: 1,
|
|
projects: [
|
|
{
|
|
id: 'faaa',
|
|
},
|
|
],
|
|
});
|
|
};
|
|
|
|
test('should show usage of context field', async () => {
|
|
setupRoutes();
|
|
|
|
const contextFieldName = 'appName';
|
|
render(<ContextFieldUsage contextName={contextFieldName} />);
|
|
|
|
await screen.findByText('Usage of this context field:');
|
|
await screen.findByText('tests (Gradual rollout)');
|
|
});
|