Skip to content
Snippets Groups Projects
Commit 7a871ffb authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge remote-tracking branch 'origin/main' into merge-18.0.8

parents 584816a0 b237ee24
No related branches found
No related tags found
1 merge request!347Merge 18.0.8
Pipeline #99286 passed
......@@ -13,6 +13,11 @@ minerva-front (19.0.0~alpha.0) stable; urgency=medium
-- Piotr Gawron <piotr.gawron@uni.lu> Fri, 18 Oct 2024 13:00:00 +0200
minerva-front (18.0.8) stable; urgency=medium
* Bug fix: data overlay removal did not work (#333)
-- Piotr Gawron <piotr.gawron@uni.lu> Fri, 13 Dec 2024 13:00:00 +0200
minerva-front (18.0.7) stable; urgency=medium
* Bug fix: export to image did not include overlays (#326)
* Bug fix: missing logos added (#329)
......
......@@ -100,7 +100,7 @@ export const apiPath = {
}): string =>
`projects/${PROJECT_ID}/overlays/?creator=${creator}&publicOverlay=${String(publicOverlay)}`,
updateOverlay: (overlayId: number): string => `projects/${PROJECT_ID}/overlays/${overlayId}/`,
removeOverlay: (overlayId: number): string => `projects/pdmap_appu_test/overlays/${overlayId}/`,
removeOverlay: (overlayId: number): string => `projects/${PROJECT_ID}/overlays/${overlayId}/`,
downloadElementsCsv: (): string =>
`projects/${PROJECT_ID}/models/*/bioEntities/elements/:downloadCsv`,
downloadOverlay: (overlayId: number): string =>
......
import { store } from '@/redux/store';
import { mockNetworkResponse } from '@/utils/mockNetworkResponse';
import { apiPath } from '@/redux/apiPath';
import { HttpStatusCode } from 'axios';
import { errorMiddlewareListener } from './error.middleware';
jest.mock('../../utils/showToast');
const mockedAxiosClient = mockNetworkResponse();
describe('errorMiddlewareListener', () => {
const dispatchSpy = jest.spyOn(store, 'dispatch');
......@@ -12,6 +17,8 @@ describe('errorMiddlewareListener', () => {
});
it('should handle error with message when action is rejected', async () => {
mockedAxiosClient.onGet(apiPath.getStacktrace('Error-2')).reply(HttpStatusCode.Ok, {});
const action = {
type: 'action/rejected',
payload: 'Error message',
......@@ -21,7 +28,7 @@ describe('errorMiddlewareListener', () => {
requestStatus: 'rejected',
},
error: {
code: 'Error 2',
code: 'Error-2',
},
};
const { getState, dispatch } = store;
......@@ -37,6 +44,7 @@ describe('errorMiddlewareListener', () => {
});
it('should handle error without message when action is rejected', async () => {
mockedAxiosClient.onGet(apiPath.getStacktrace('Error-3')).reply(HttpStatusCode.Ok, {});
const action = {
type: 'action/rejected',
payload: null,
......@@ -46,7 +54,7 @@ describe('errorMiddlewareListener', () => {
requestStatus: 'rejected',
},
error: {
code: 'Error 3',
code: 'Error-3',
},
};
const { getState, dispatch } = store;
......@@ -78,6 +86,7 @@ describe('errorMiddlewareListener', () => {
});
it('should handle error with unknown error message when action payload is not a string', async () => {
mockedAxiosClient.onGet(apiPath.getStacktrace('ERROR')).reply(HttpStatusCode.Ok, {});
const action = {
type: 'action/rejected',
payload: {},
......@@ -104,6 +113,7 @@ describe('errorMiddlewareListener', () => {
});
it('should handle error with custom message when action payload is a string', async () => {
mockedAxiosClient.onGet(apiPath.getStacktrace('ERROR')).reply(HttpStatusCode.Ok, {});
const action = {
type: 'action/rejected',
payload: 'Failed to fetch',
......@@ -133,6 +143,7 @@ describe('errorMiddlewareListener', () => {
});
it('should show modal on access denied', async () => {
mockedAxiosClient.onGet(apiPath.getStacktrace('403')).reply(HttpStatusCode.Ok, {});
const action = {
type: 'action/rejected',
payload: null,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment