31 lines
912 B
TypeScript
31 lines
912 B
TypeScript
|
|
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||
|
|
|
||
|
|
describe('feature flags', () => {
|
||
|
|
afterEach(() => {
|
||
|
|
vi.unstubAllEnvs();
|
||
|
|
vi.resetModules();
|
||
|
|
});
|
||
|
|
|
||
|
|
it('defaults the mobile CTA button to disabled', async () => {
|
||
|
|
const { isMobileCtaButtonEnabled } = await import('./feature-flags');
|
||
|
|
|
||
|
|
expect(isMobileCtaButtonEnabled()).toBe(false);
|
||
|
|
});
|
||
|
|
|
||
|
|
it('enables the mobile CTA button when the public env flag is truthy', async () => {
|
||
|
|
vi.stubEnv('PUBLIC_ENABLE_MOBILE_CTA_BUTTON', 'enabled');
|
||
|
|
|
||
|
|
const { isMobileCtaButtonEnabled } = await import('./feature-flags');
|
||
|
|
|
||
|
|
expect(isMobileCtaButtonEnabled()).toBe(true);
|
||
|
|
});
|
||
|
|
|
||
|
|
it('treats explicit false values as disabled', async () => {
|
||
|
|
vi.stubEnv('PUBLIC_ENABLE_MOBILE_CTA_BUTTON', 'off');
|
||
|
|
|
||
|
|
const { isMobileCtaButtonEnabled } = await import('./feature-flags');
|
||
|
|
|
||
|
|
expect(isMobileCtaButtonEnabled()).toBe(false);
|
||
|
|
});
|
||
|
|
});
|