Skip to content

Commit

Permalink
test: Update cache test to correctly assert fetch headers
Browse files Browse the repository at this point in the history
  • Loading branch information
ctoth committed Dec 2, 2024
1 parent a4240d7 commit cd14902
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/cache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,10 @@ describe("AudioCache", () => {
const result = await cache.getAudioBuffer(audioContextMock, url);

expect(result).toBe(mockAudioBuffer);
expect(mockFetch).toHaveBeenCalledWith(url, {
headers: expect.objectContaining({
'If-None-Match': etag
})
});
const fetchCall = mockFetch.mock.calls[0];
expect(fetchCall[0]).toBe(url);
const headers = fetchCall[1].headers as Headers;
expect(headers.get('If-None-Match')).toBe(etag);
});

it("handles cache expiration", async () => {
Expand Down

0 comments on commit cd14902

Please sign in to comment.