expose normalizeResponse
sibelius opened this issue · 0 comments
sibelius commented
I'd like to build something like this
export const assertFetch = (url, options, fn: MockResponseInitFunction) => {
fetchMock.mockResponseOnce(async (req) => {
expect(req.url).toBe(url);
expect(req.options).toEqual(options);
return normalizeResponse(fn);
});
};
Where I assert the value of url and option of the request, but also mock the response
for this, I need to reuse normalizeResponse
to keep the same api