diff --git a/packages/core/admin/admin/src/utils/tests/fetchClient.test.js b/packages/core/admin/admin/src/utils/tests/fetchClient.test.js index 101bb3e481..6b731b45dd 100644 --- a/packages/core/admin/admin/src/utils/tests/fetchClient.test.js +++ b/packages/core/admin/admin/src/utils/tests/fetchClient.test.js @@ -12,7 +12,6 @@ import { const token = 'coolToken'; auth.getToken = jest.fn().mockReturnValue(token); auth.clearAppStorage = jest.fn().mockReturnValue(token); -process.env.STRAPI_ADMIN_BACKEND_URL = 'http://localhost:1337'; describe('ADMIN | utils | fetchClient', () => { describe('Test the interceptors', () => { @@ -25,12 +24,12 @@ describe('ADMIN | utils | fetchClient', () => { expect(result.headers.Accept).toBe('application/json'); expect(apiInstance.interceptors.response.handlers[0].fulfilled('foo')).toBe('foo'); }); - describe('Test the addInterceptor funcion', () => { + describe('Test the addInterceptor function', () => { afterEach(() => { // restore the spy created with spyOn jest.restoreAllMocks(); }); - it('should add a response interceptor to the axios instance', () => { + it('should add a response interceptor to the fetchClient instance', () => { const apiInstance = fetchClient({ baseUrl: 'http://strapi-test', }); @@ -67,7 +66,7 @@ describe('ADMIN | utils | fetchClient', () => { url: '/test', }; const configResponse = await reqInterceptor(configMock); - expect(configResponse.headers.Authorization).toBe('Bearer coolToken'); + expect(configResponse.headers.Authorization).toBe(`Bearer ${token}`); }); }); it('should throw an error when the request interceptor error callback is called', () => { diff --git a/packages/core/admin/admin/src/utils/tests/getFetchClient.test.js b/packages/core/admin/admin/src/utils/tests/getFetchClient.test.js index 507b91d2d0..92635db186 100644 --- a/packages/core/admin/admin/src/utils/tests/getFetchClient.test.js +++ b/packages/core/admin/admin/src/utils/tests/getFetchClient.test.js @@ -3,8 +3,6 @@ import { getFetchClient } from '../getFetchClient'; const token = 'coolToken'; auth.getToken = jest.fn().mockReturnValue(token); -auth.clearAppStorage = jest.fn().mockReturnValue(token); -process.env.STRAPI_ADMIN_BACKEND_URL = 'http://localhost:1337'; describe('ADMIN | utils | getFetchClient', () => { it('should return the 4 HTTP methods to call GET, POST, PUT and DELETE apis', () => {