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

@ -93,7 +93,6 @@ describe('github API', () => {
beforeEach(() => {
const fetch = jest.fn();
global.fetch = fetch;
global.Date = jest.fn(() => ({ getTime: () => 1000 }));
});
afterEach(() => {
@ -112,7 +111,8 @@ describe('github API', () => {
const result = await api.request('/some-path');
expect(result).toEqual('some response');
expect(fetch).toHaveBeenCalledTimes(1);
expect(fetch).toHaveBeenCalledWith('https://api.github.com/some-path?ts=1000', {
expect(fetch).toHaveBeenCalledWith('https://api.github.com/some-path', {
cache: 'no-cache',
headers: {
Authorization: 'token token',
'Content-Type': 'application/json; charset=utf-8',
@ -157,7 +157,8 @@ describe('github API', () => {
const result = await api.request('/some-path');
expect(result).toEqual('some response');
expect(fetch).toHaveBeenCalledTimes(1);
expect(fetch).toHaveBeenCalledWith('https://api.github.com/some-path?ts=1000', {
expect(fetch).toHaveBeenCalledWith('https://api.github.com/some-path', {
cache: 'no-cache',
headers: {
Authorization: 'promise-token',
'Content-Type': 'application/json; charset=utf-8',