1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/frontend/src/utils/env.test.ts
olav 2e367b3a04 feat: add trial expiration warning banner (#985)
* refactor: simplify useApiGetter cache keys

* refactor: simplify basePath helpers

* refactor: add UNLEASH_BASE_PATH frontend env var

* refactor: make sure AnnouncerElement does not affect the layout

* refactor: draw texture image above footer

* refactor: extract domain check helpers

* refactor: fix a few ts-expect-errors

* feat: add trial expiration warning banner

* refactor: fix IInstanceStatus interface prefix

* refactor: use ConditionallyRender in InstanceStatus

* refactor: simplify env helper functions

* refactor: use FC in InstanceStatus

* refactor: warn about expired trials

* refactor: fix eslint warnings

* refactor: disable banner outside of localhost

* refactor: use new instance state field name
2022-05-19 14:06:18 +02:00

26 lines
889 B
TypeScript

import {
isLocalhostDomain,
isVercelBranchDomain,
isUnleashDomain,
} from 'utils/env';
test('isLocalhostDomain', () => {
expect(isLocalhostDomain()).toEqual(true);
expect(isLocalhostDomain('unleash-hosted.com')).toEqual(false);
});
test('isUnleashDomain', () => {
expect(isUnleashDomain()).toEqual(false);
expect(isUnleashDomain('vercel.app')).toEqual(false);
expect(isUnleashDomain('app.getunleash.io')).toEqual(true);
expect(isUnleashDomain('app.unleash-hosted.com')).toEqual(true);
});
test('isVercelBranchDomain', () => {
expect(isVercelBranchDomain()).toEqual(false);
expect(isVercelBranchDomain('getunleash.io')).toEqual(false);
expect(isVercelBranchDomain('unleash-hosted.com')).toEqual(false);
expect(isVercelBranchDomain('vercel.app')).toEqual(false);
expect(isVercelBranchDomain('branch.vercel.app')).toEqual(true);
});