Skip to content
Snippets Groups Projects
Commit 667cde19 authored by mateusz-winiarczyk's avatar mateusz-winiarczyk
Browse files

test(overlay): add test for download overlay

parent b0d6bc8a
No related branches found
No related tags found
1 merge request!108feat(overlays): overlay is downloadable (MIN-237)
...@@ -17,6 +17,7 @@ import { apiPath } from '@/redux/apiPath'; ...@@ -17,6 +17,7 @@ import { apiPath } from '@/redux/apiPath';
import { CORE_PD_MODEL_MOCK } from '@/models/mocks/modelsMock'; import { CORE_PD_MODEL_MOCK } from '@/models/mocks/modelsMock';
import { MODELS_INITIAL_STATE_MOCK } from '@/redux/models/models.mock'; import { MODELS_INITIAL_STATE_MOCK } from '@/redux/models/models.mock';
import { parseOverlayBioEntityToOlRenderingFormat } from '@/redux/overlayBioEntity/overlayBioEntity.utils'; import { parseOverlayBioEntityToOlRenderingFormat } from '@/redux/overlayBioEntity/overlayBioEntity.utils';
import { BASE_API_URL } from '@/constants';
import { OverlayListItem } from './OverlayListItem.component'; import { OverlayListItem } from './OverlayListItem.component';
const mockedAxiosNewClient = mockNetworkNewAPIResponse(); const mockedAxiosNewClient = mockNetworkNewAPIResponse();
...@@ -111,6 +112,29 @@ describe('OverlayListItem - component', () => { ...@@ -111,6 +112,29 @@ describe('OverlayListItem - component', () => {
}); });
}); });
// TODO implement when connecting logic to component it('should trigger download overlay to PC on download button click', () => {
it.skip('should trigger download overlay to PC on download button click', () => {}); const OVERLAY_ID = 21;
renderComponent({
map: {
...initialMapStateFixture,
data: { ...initialMapStateFixture.data, backgroundId: EMPTY_BACKGROUND_ID },
},
backgrounds: { ...BACKGROUND_INITIAL_STATE_MOCK, data: BACKGROUNDS_MOCK },
overlayBioEntity: { ...OVERLAY_BIO_ENTITY_INITIAL_STATE_MOCK, overlaysId: [OVERLAY_ID] },
models: { ...MODELS_INITIAL_STATE_MOCK, data: [CORE_PD_MODEL_MOCK] },
});
const downloadButton = screen.getByText('Download');
expect(downloadButton).toBeVisible();
const windowOpenMock = jest.spyOn(window, 'open').mockImplementation();
downloadButton.click();
expect(windowOpenMock).toHaveBeenCalledWith(
`${BASE_API_URL}/${apiPath.downloadOverlay(OVERLAY_ID)}`,
'_blank',
);
});
}); });
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