Aligns mock API_BASE with the real ApiClient's origin fallback
Continuous Integration / config (pull_request) Successful in 9s
Continuous Integration / backend-build (pull_request) Successful in 4m2s
Continuous Integration / backend-test (pull_request) Successful in 4m35s
Continuous Integration / vulnerability-scan (pull_request) Successful in 3m41s
Continuous Integration / frontend-prepare (pull_request) Successful in 1m35s
Continuous Integration / frontend-build (pull_request) Successful in 2m7s
Continuous Integration / frontend-test (pull_request) Successful in 4m22s
Continuous Integration / frontend-lint (pull_request) Successful in 1m51s
Continuous Integration / publish-production (pull_request) Skipped
Continuous Integration / deploy-production (pull_request) Skipped
Continuous Integration / publish-test (pull_request) Successful in 5m17s
Continuous Integration / deploy-test (pull_request) Skipped
Continuous Integration / config (pull_request) Successful in 9s
Continuous Integration / backend-build (pull_request) Successful in 4m2s
Continuous Integration / backend-test (pull_request) Successful in 4m35s
Continuous Integration / vulnerability-scan (pull_request) Successful in 3m41s
Continuous Integration / frontend-prepare (pull_request) Successful in 1m35s
Continuous Integration / frontend-build (pull_request) Successful in 2m7s
Continuous Integration / frontend-test (pull_request) Successful in 4m22s
Continuous Integration / frontend-lint (pull_request) Successful in 1m51s
Continuous Integration / publish-production (pull_request) Skipped
Continuous Integration / deploy-production (pull_request) Skipped
Continuous Integration / publish-test (pull_request) Successful in 5m17s
Continuous Integration / deploy-test (pull_request) Skipped
The mocks re-derived VITE_API_BASE_URL with their own fallback instead of reusing getAppConfig().apiBaseUrl, so the two silently diverged whenever the env var was unset (as in CI, where no local .env.local is present) — every MSW-intercepted request then had no matching handler.
This commit is contained in:
@@ -1,7 +1,14 @@
|
|||||||
import type { AuthResponse, User } from '@/api/types';
|
import type { AuthResponse, User } from '@/api/types';
|
||||||
|
import { getAppConfig } from '@/lib/config';
|
||||||
|
|
||||||
/** Base URL the ApiClient targets; mocks must match the absolute URL. */
|
/**
|
||||||
export const API_BASE = import.meta.env.VITE_API_BASE_URL ?? 'http://localhost:5000';
|
* Base URL the ApiClient targets; mocks must match it exactly. Reads the same
|
||||||
|
* getAppConfig().apiBaseUrl the real ApiClient is constructed with, rather than
|
||||||
|
* re-deriving VITE_API_BASE_URL with its own fallback — a second, diverging default here
|
||||||
|
* previously matched the real client's origin only when a local .env.local happened to set
|
||||||
|
* VITE_API_BASE_URL, and silently mismatched (all mocks unmatched) whenever it was unset, as in CI.
|
||||||
|
*/
|
||||||
|
export const API_BASE = getAppConfig().apiBaseUrl;
|
||||||
|
|
||||||
export const TEST_CREDENTIALS = {
|
export const TEST_CREDENTIALS = {
|
||||||
email: 'owner@example.com',
|
email: 'owner@example.com',
|
||||||
|
|||||||
Reference in New Issue
Block a user