refactor: use fetch cache arg instead of cache busting (#3584)

This commit is contained in:
Erez Rokah
2020-04-21 17:46:06 +03:00
committed by GitHub
parent 9b79623bc8
commit 8f1b325809
147 changed files with 70994 additions and 51781 deletions

View File

@ -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 () => {