1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-05 17:53:12 +02:00

test: extract irrelevant details

This commit is contained in:
kwasniew 2024-05-14 15:19:58 +02:00
parent 434abe9c71
commit d38fbdb184
No known key found for this signature in database
GPG Key ID: 43A7CBC24C119560

View File

@ -9,7 +9,7 @@ import {
DEFAULT_STRATEGY_SEGMENTS_LIMIT,
} from '../../util/segments';
import type TestAgent from 'supertest/lib/agent';
import type { IUnleashStores } from '../../types';
import type { IUnleashStores, IVariant } from '../../types';
const uiConfig = {
headerBackground: 'red',
@ -109,22 +109,21 @@ describe('hideFeatureEnvironmentVariants', () => {
expect(body.flags.hideFeatureEnvironmentVariants).toEqual(true);
});
test('ui config should have hideFeatureEnvironmentVariants flag disabled if env variants are used', async () => {
await stores.featureEnvironmentStore.addEnvironmentToFeature(
'test',
'default',
true,
);
await stores.featureEnvironmentStore.addVariantsToFeatureEnvironment(
'test',
'default',
[
{
const someVariant: IVariant = {
name: 'a',
weight: 1,
weightType: 'fix',
stickiness: 'default',
},
],
};
await stores.featureEnvironmentStore.addEnvironmentToFeature(
'feature',
'production',
true,
);
await stores.featureEnvironmentStore.addVariantsToFeatureEnvironment(
'feature',
'production',
[someVariant],
);
const { body } = await request
.get(`${base}/api/admin/ui-config`)