fetch-mock-jest icon indicating copy to clipboard operation
fetch-mock-jest copied to clipboard

`headers` are not matched strictly

Open posva opened this issue 3 years ago • 0 comments

Hello I noticed that when using toHaveFetched(url, { headers: {} }), it will always pass no matter what headers are passed but it should pass only if no headers are passed

    fetchMock.get('/api', { body: {} })
// custom wrapper around fetch
    await api.get('2')
    expect(fetchMock).toHaveFetched('/api/2', {
      headers: {
        // no Accept
        Accept: 'application/json'
        // 'Content-Type': 'application/json',
      },
    })

posva avatar Mar 09 '21 15:03 posva