MCPcopy Create free account
hub / github.com/dailydotdev/apps / mockBootResponses

Function mockBootResponses

packages/shared/src/lib/boot.spec.ts:11–20  ·  view source on GitHub ↗
(...responses: Record<string, unknown>[])

Source from the content-addressed store, hash-verified

9const freshFeatures = { fresh_flag: { defaultValue: true } };
10
11const mockBootResponses = (...responses: Record<string, unknown>[]) => {
12 const fetchMock = jest.fn();
13 responses.forEach((response) =>
14 fetchMock.mockResolvedValueOnce({
15 json: jest.fn().mockResolvedValue(response),
16 }),
17 );
18 global.fetch = fetchMock as unknown as typeof fetch;
19 return fetchMock;
20};
21
22const getRequestedFv = (fetchMock: jest.Mock, call = 0) =>
23 new URL(fetchMock.mock.calls[call][0]).searchParams.get('fv');

Callers 1

boot.spec.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected