MCPcopy Create free account
hub / github.com/fontsource/fontsource / mockMetadata

Function mockMetadata

api/metadata/tests/helpers.ts:3–17  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import fontsourceMetadata from './fixtures/fontsource.json';
2
3export const mockMetadata = () => {
4 const fetchMock = getMiniflareFetchMock();
5 // Throw when no matching mocked request is found
6 fetchMock.disableNetConnect();
7
8 // Handlers
9 // We want this to be the default response for all requests
10 const origin = fetchMock.get('https://raw.githubusercontent.com');
11 origin
12 .intercept({
13 method: 'GET',
14 path: '/fontsource/font-files/main/metadata/fontsource.json',
15 })
16 .reply(200, JSON.stringify(fontsourceMetadata));
17};

Callers 3

fontlist.test.tsFile · 0.90
id.test.tsFile · 0.90
fonts.test.tsFile · 0.90

Calls 2

replyMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected