diff --git a/src/constants/httpResponses.ts b/src/constants/httpResponses.ts deleted file mode 100644 index e017a787f444b430f475d6b15d45f61f3e52bc1c..0000000000000000000000000000000000000000 --- a/src/constants/httpResponses.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const HTTP_OK = 200; -export const HTTP_NOT_FOUND = 404; diff --git a/src/redux/drugs/drugs.reducers.test.ts b/src/redux/drugs/drugs.reducers.test.ts index d62b3a1e2e3019562204b330d238eb838d2be63a..4bf965003d8fdbb9d183c209a7eb88b4ea56c720 100644 --- a/src/redux/drugs/drugs.reducers.test.ts +++ b/src/redux/drugs/drugs.reducers.test.ts @@ -1,6 +1,6 @@ +import { HttpStatusCode } from 'axios'; import { PROJECT_ID } from '@/constants/mapId'; import { drugsFixture } from '@/models/fixtures/drugFixtures'; -import { HTTP_NOT_FOUND, HTTP_OK } from '@/constants/httpResponses'; import { mockNetworkResponse } from '@/utils/mockNetworkResponse'; import { ToolkitStoreWithSingleSlice, @@ -33,7 +33,7 @@ describe('drugs reducer', () => { it('should update store after succesfull getDrugs query', async () => { mockedAxiosClient .onGet(`projects/${PROJECT_ID}/drugs:search?query=${SEARCH_QUERY}`) - .reply(HTTP_OK, drugsFixture); + .reply(HttpStatusCode.Ok, drugsFixture); const { type } = await store.dispatch(getDrugs(SEARCH_QUERY)); const { data, loading, error } = store.getState().drugs; @@ -47,7 +47,7 @@ describe('drugs reducer', () => { it('should update store after failed getDrugs query', async () => { mockedAxiosClient .onGet(`projects/${PROJECT_ID}/drugs:search?query=${SEARCH_QUERY}`) - .reply(HTTP_NOT_FOUND, []); + .reply(HttpStatusCode.NotFound, []); const { type } = await store.dispatch(getDrugs(SEARCH_QUERY)); const { data, loading, error } = store.getState().drugs; @@ -61,7 +61,7 @@ describe('drugs reducer', () => { it('should update store on loading getDrugs query', async () => { mockedAxiosClient .onGet(`projects/${PROJECT_ID}/drugs:search?query=${SEARCH_QUERY}`) - .reply(HTTP_OK, drugsFixture); + .reply(HttpStatusCode.Ok, drugsFixture); const drugsPromise = store.dispatch(getDrugs(SEARCH_QUERY)); diff --git a/src/redux/drugs/drugs.thunks.test.ts b/src/redux/drugs/drugs.thunks.test.ts index a90e8c5edf80337116f7960aa60ad9be47197b6f..ee7d1c2e2a90a71f96fe558299779bbba438e6cb 100644 --- a/src/redux/drugs/drugs.thunks.test.ts +++ b/src/redux/drugs/drugs.thunks.test.ts @@ -1,6 +1,6 @@ +import { HttpStatusCode } from 'axios'; import { PROJECT_ID } from '@/constants/mapId'; import { drugsFixture } from '@/models/fixtures/drugFixtures'; -import { HTTP_OK } from '@/constants/httpResponses'; import { mockNetworkResponse } from '@/utils/mockNetworkResponse'; import { ToolkitStoreWithSingleSlice, @@ -22,7 +22,7 @@ describe('drugs thunks', () => { it('should return data when data response from API is valid', async () => { mockedAxiosClient .onGet(`projects/${PROJECT_ID}/drugs:search?query=${SEARCH_QUERY}`) - .reply(HTTP_OK, drugsFixture); + .reply(HttpStatusCode.Ok, drugsFixture); const { payload } = await store.dispatch(getDrugs(SEARCH_QUERY)); expect(payload).toEqual(drugsFixture); @@ -30,7 +30,7 @@ describe('drugs thunks', () => { it('should return undefined when data response from API is not valid ', async () => { mockedAxiosClient .onGet(`projects/${PROJECT_ID}/drugs:search?query=${SEARCH_QUERY}`) - .reply(HTTP_OK, { randomProperty: 'randomValue' }); + .reply(HttpStatusCode.Ok, { randomProperty: 'randomValue' }); const { payload } = await store.dispatch(getDrugs(SEARCH_QUERY)); expect(payload).toEqual(undefined);