mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-19 21:31:46 +00:00
fix(tests): restore native AbortController for undici fetch compatibility
jsdom replaces globalThis.AbortController with its own implementation; Node.js undici-based fetch validates signals via instanceof against the native AbortSignal, causing fetch to throw before MSW could intercept. Fix via custom Vitest environment (tests/environment/jsdom-native-abort.ts) that captures native AbortController/AbortSignal before jsdom patches them and restores them after jsdom setup. Also updates JournalBody test 004 to match component behaviour (headings rendered as <p>) and removes debug console.log statements.
This commit is contained in:
@@ -148,6 +148,7 @@ describe('journeyStore', () => {
|
||||
);
|
||||
await expect(useJourneyStore.getState().loadJourney(999)).rejects.toThrow();
|
||||
expect(useJourneyStore.getState().loading).toBe(false);
|
||||
expect(useJourneyStore.getState().notFound).toBe(true);
|
||||
});
|
||||
|
||||
// ── createJourney ────────────────────────────────────────────────────────
|
||||
|
||||
@@ -131,6 +131,7 @@ export const useJourneyStore = create<JourneyState>((set, get) => ({
|
||||
if (err?.response?.status === 404) {
|
||||
set({ current: null, notFound: true })
|
||||
}
|
||||
throw err
|
||||
} finally {
|
||||
set({ loading: false })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user