1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-13 11:17:26 +02:00
unleash.unleash/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentDiffTable.test.tsx
2023-10-06 09:19:49 +02:00

63 lines
1.9 KiB
TypeScript

import { screen } from '@testing-library/react';
import { render } from 'utils/testRenderer';
import { PlaygroundEnvironmentDiffTable } from './PlaygroundEnvironmentDiffTable';
const irrelevantDetails = {
strategies: {
data: [],
result: false,
},
isEnabledInCurrentEnvironment: true,
variants: [],
variant: {
name: 'variantName',
enabled: true,
payload: {
type: 'string' as const,
value: 'variantValue',
},
},
projectId: 'projectA',
};
test('should render environment diff table', async () => {
render(
<PlaygroundEnvironmentDiffTable
features={{
development: [
{
name: 'featureA',
isEnabled: true,
environment: 'development',
context: {
channel: 'web',
client: 'clientA',
appName: 'myapp',
},
...irrelevantDetails,
},
],
production: [
{
name: 'featureA',
isEnabled: false,
environment: 'production',
context: {
channel: 'web',
client: 'clientA',
appName: 'myapp',
},
...irrelevantDetails,
},
],
}}
/>,
);
expect(screen.getByText('web')).toBeInTheDocument();
expect(screen.getByText('clientA')).toBeInTheDocument();
expect(screen.getByText('True')).toBeInTheDocument();
expect(screen.getByText('False')).toBeInTheDocument();
expect(screen.getByText('myapp')).toBeInTheDocument();
});