Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose normalizeResponse #246

Open
sibelius opened this issue Apr 22, 2023 · 0 comments
Open

expose normalizeResponse #246

sibelius opened this issue Apr 22, 2023 · 0 comments

Comments

@sibelius
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant