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

feat: use hide env variants instead of display

This commit is contained in:
kwasniew 2024-05-14 14:51:43 +02:00
parent 80049c2fa9
commit 9112662c31
No known key found for this signature in database
GPG Key ID: 43A7CBC24C119560
3 changed files with 8 additions and 8 deletions

View File

@ -99,16 +99,16 @@ describe('displayUpgradeEdgeBanner', () => {
}); });
}); });
describe('displayFeatureEnvironmentVariants', () => { describe('hideFeatureEnvironmentVariants', () => {
test('ui config should have displayFeatureEnvironmentVariants flag disabled if no env variants are used', async () => { test('ui config should have hideFeatureEnvironmentVariants flag enabled if no env variants are used', async () => {
const { body } = await request const { body } = await request
.get(`${base}/api/admin/ui-config`) .get(`${base}/api/admin/ui-config`)
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200); .expect(200);
expect(body.flags).toBeTruthy(); expect(body.flags).toBeTruthy();
expect(body.flags.displayFeatureEnvironmentVariants).toEqual(false); expect(body.flags.hideFeatureEnvironmentVariants).toEqual(true);
}); });
test('ui config should have displayFeatureEnvironmentVariants flag enabled if env variants are used', async () => { test('ui config should have hideFeatureEnvironmentVariants flag disabled if env variants are used', async () => {
await stores.featureEnvironmentStore.addEnvironmentToFeature( await stores.featureEnvironmentStore.addEnvironmentToFeature(
'test', 'test',
'default', 'default',
@ -131,6 +131,6 @@ describe('displayFeatureEnvironmentVariants', () => {
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200); .expect(200);
expect(body.flags).toBeTruthy(); expect(body.flags).toBeTruthy();
expect(body.flags.displayFeatureEnvironmentVariants).toEqual(true); expect(body.flags.hideFeatureEnvironmentVariants).toEqual(false);
}); });
}); });

View File

@ -167,7 +167,7 @@ class ConfigController extends Controller {
displayUpgradeEdgeBanner: displayUpgradeEdgeBanner:
usesOldEdge || usesOldEdge ||
this.config.flagResolver.isEnabled('displayEdgeBanner'), this.config.flagResolver.isEnabled('displayEdgeBanner'),
displayFeatureEnvironmentVariants: usesFeatureEnvironmentVariants, hideFeatureEnvironmentVariants: !usesFeatureEnvironmentVariants,
}; };
const response: UiConfigSchema = { const response: UiConfigSchema = {

View File

@ -99,11 +99,11 @@ test('sets ui config with frontendSettings', async () => {
); );
}); });
test('ui config should have displayFeatureEnvironmentVariants flag disabled if no env variants are used', async () => { test('ui config should have hideFeatureEnvironmentVariants flag enabled if no env variants are used', async () => {
const { body } = await app.request const { body } = await app.request
.get('/api/admin/ui-config') .get('/api/admin/ui-config')
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200); .expect(200);
expect(body.flags).toBeTruthy(); expect(body.flags).toBeTruthy();
expect(body.flags.displayFeatureEnvironmentVariants).toEqual(false); expect(body.flags.hideFeatureEnvironmentVariants).toEqual(true);
}); });