Files
life-echo/app-expo/tests/core/config.test.ts
2026-05-20 10:27:40 +08:00

28 lines
784 B
TypeScript

import {
appVariant,
config,
shouldShowAboutBackendUrl,
type AppVariant,
} from '@/core/config';
describe('shouldShowAboutBackendUrl', () => {
it('shows backend URL for development and staging', () => {
expect(shouldShowAboutBackendUrl('development')).toBe(true);
expect(shouldShowAboutBackendUrl('staging')).toBe(true);
});
it('hides backend URL for production when not in __DEV__', () => {
if (__DEV__) {
expect(shouldShowAboutBackendUrl('production')).toBe(true);
} else {
expect(shouldShowAboutBackendUrl('production')).toBe(false);
}
});
it('matches config.showAboutBackendUrl for current build', () => {
expect(config.showAboutBackendUrl).toBe(
shouldShowAboutBackendUrl(appVariant as AppVariant),
);
});
});