refactor: use fetch cache arg instead of cache busting (#3584)
This commit is contained in:
@ -5,7 +5,6 @@ describe('github API', () => {
|
||||
beforeEach(() => {
|
||||
const fetch = jest.fn();
|
||||
global.fetch = fetch;
|
||||
global.Date = jest.fn(() => ({ getTime: () => 1000 }));
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@ -27,15 +26,13 @@ describe('github API', () => {
|
||||
const result = await api.request('/some-path');
|
||||
expect(result).toEqual('some response');
|
||||
expect(fetch).toHaveBeenCalledTimes(1);
|
||||
expect(fetch).toHaveBeenCalledWith(
|
||||
'https://site.netlify.com/.netlify/git/github/some-path?ts=1000',
|
||||
{
|
||||
headers: {
|
||||
Authorization: 'Bearer token',
|
||||
'Content-Type': 'application/json; charset=utf-8',
|
||||
},
|
||||
expect(fetch).toHaveBeenCalledWith('https://site.netlify.com/.netlify/git/github/some-path', {
|
||||
cache: 'no-cache',
|
||||
headers: {
|
||||
Authorization: 'Bearer token',
|
||||
'Content-Type': 'application/json; charset=utf-8',
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('should throw error on not ok response with message property', async () => {
|
||||
|
Reference in New Issue
Block a user