1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-08 01:15:49 +02:00
unleash.unleash/frontend/src/component/segments/SegmentTable/SegmentTable.test.tsx
2024-05-22 16:26:22 +03:00

38 lines
1014 B
TypeScript

import { render } from 'utils/testRenderer';
import { screen } from '@testing-library/react';
import { SegmentTable } from './SegmentTable';
import { testServerRoute, testServerSetup } from 'utils/testServer';
const server = testServerSetup();
const setupRoutes = () => {
testServerRoute(server, 'api/admin/segments', {
segments: [
{
id: 2,
name: 'test2',
description: '',
usedInProjects: 3,
usedInFeatures: 2,
constraints: [],
createdBy: 'admin',
createdAt: '2023-05-24T06:23:07.797Z',
},
],
});
testServerRoute(server, '/api/admin/ui-config', {
flags: {
SE: true,
},
});
};
test('should show the count of projects and features used in', async () => {
setupRoutes();
render(<SegmentTable />);
await screen.findByText('2 feature flags');
await screen.findByText('3 projects');
});