This commit is contained in:
2026-03-29 10:26:38 -05:00
parent 05d4f6e78b
commit b1c99893a6
1628 changed files with 67782 additions and 60143 deletions

View File

@@ -1,29 +1,29 @@
import { getConfiguredApiBaseUrl, getConfiguredAssetBaseUrl } from '../../utils/backendUrl';
describe('backendUrl utilities', () => {
const originalApiUrl = process.env.EXPO_PUBLIC_API_URL;
const originalBackendUrl = process.env.EXPO_PUBLIC_BACKEND_URL;
const originalPaymentServerUrl = process.env.EXPO_PUBLIC_PAYMENT_SERVER_URL;
afterEach(() => {
process.env.EXPO_PUBLIC_API_URL = originalApiUrl;
process.env.EXPO_PUBLIC_BACKEND_URL = originalBackendUrl;
process.env.EXPO_PUBLIC_PAYMENT_SERVER_URL = originalPaymentServerUrl;
});
it('prefers EXPO_PUBLIC_API_URL when present', () => {
process.env.EXPO_PUBLIC_API_URL = 'https://api.example.com/api';
process.env.EXPO_PUBLIC_BACKEND_URL = 'https://backend.example.com';
expect(getConfiguredApiBaseUrl()).toBe('https://api.example.com/api');
expect(getConfiguredAssetBaseUrl()).toBe('https://api.example.com');
});
it('falls back to EXPO_PUBLIC_BACKEND_URL and appends /api', () => {
delete process.env.EXPO_PUBLIC_API_URL;
process.env.EXPO_PUBLIC_BACKEND_URL = 'https://backend.example.com';
expect(getConfiguredApiBaseUrl()).toBe('https://backend.example.com/api');
expect(getConfiguredAssetBaseUrl()).toBe('https://backend.example.com');
});
});
import { getConfiguredApiBaseUrl, getConfiguredAssetBaseUrl } from '../../utils/backendUrl';
describe('backendUrl utilities', () => {
const originalApiUrl = process.env.EXPO_PUBLIC_API_URL;
const originalBackendUrl = process.env.EXPO_PUBLIC_BACKEND_URL;
const originalPaymentServerUrl = process.env.EXPO_PUBLIC_PAYMENT_SERVER_URL;
afterEach(() => {
process.env.EXPO_PUBLIC_API_URL = originalApiUrl;
process.env.EXPO_PUBLIC_BACKEND_URL = originalBackendUrl;
process.env.EXPO_PUBLIC_PAYMENT_SERVER_URL = originalPaymentServerUrl;
});
it('prefers EXPO_PUBLIC_API_URL when present', () => {
process.env.EXPO_PUBLIC_API_URL = 'https://api.example.com/api';
process.env.EXPO_PUBLIC_BACKEND_URL = 'https://backend.example.com';
expect(getConfiguredApiBaseUrl()).toBe('https://api.example.com/api');
expect(getConfiguredAssetBaseUrl()).toBe('https://api.example.com');
});
it('falls back to EXPO_PUBLIC_BACKEND_URL and appends /api', () => {
delete process.env.EXPO_PUBLIC_API_URL;
process.env.EXPO_PUBLIC_BACKEND_URL = 'https://backend.example.com';
expect(getConfiguredApiBaseUrl()).toBe('https://backend.example.com/api');
expect(getConfiguredAssetBaseUrl()).toBe('https://backend.example.com');
});
});