Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

test(dashboard): the pair-change test stubs fetch with its own mock instead of a promise-returning mockImplementation

Maurice1866dca818ad
diff --git a/client/src/components/Dashboard/useCurrencyConverter.test.ts b/client/src/components/Dashboard/useCurrencyConverter.test.ts
index b867b67f9..abe7897c9 100644
--- a/client/src/components/Dashboard/useCurrencyConverter.test.ts
+++ b/client/src/components/Dashboard/useCurrencyConverter.test.ts
@@ -147,9 +147,10 @@ describe('useCurrencyConverter', () => {
});
it('FE-COMP-FXHOOK-010: #3009 never prices a new pair with the previous base and says it is still loading', async () => {
- fetchMock.mockImplementation((url: string) =>
+ fetchMock = vi.fn((url: string) =>
respond(url.endsWith('base=JPY') ? [{ quote: 'EUR', rate: 0.0056 }] : [{ quote: 'USD', rate: 1.1 }])
);
+ vi.stubGlobal('fetch', fetchMock);
const { result } = renderHook(() => useCurrencyConverter());
await waitFor(() => expect(result.current.rate).toBe(1.1));