Skip to content

Commit

Permalink
test: Add unit tests for new fetch behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaeelaudibert committed Dec 11, 2024
1 parent 9df3836 commit f088b43
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/__tests__/request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,23 @@ describe('request', () => {
})
})

it('supports nextOptions parameter', async () => {
request(
createRequest({
fetchOptions: { cache: 'force-cache', next: { revalidate: 0, tags: ['test'] } },
})
)
await flushPromises()

expect(mockedFetch).toHaveBeenCalledWith(
expect.anything(),
expect.objectContaining({
cache: 'force-cache',
next: { revalidate: 0, tags: ['test'] },
})
)
})

describe('keepalive with fetch and large bodies can cause some browsers to reject network calls', () => {
it.each([
['always keepalive with small json POST', 'POST', 'small', undefined, true, ''],
Expand Down

0 comments on commit f088b43

Please sign in to comment.