From 4a1c589a2c0d6496b75ffb402c6887cff935754a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tadeusz=20Miesi=C4=85c?= <tadeusz.miesiac@gmail.com> Date: Thu, 2 Nov 2023 15:52:33 +0100 Subject: [PATCH] test(map navigation): separated two tests --- .../MapNavigation.component.test.tsx | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/components/FunctionalArea/MapNavigation/MapNavigation.component.test.tsx b/src/components/FunctionalArea/MapNavigation/MapNavigation.component.test.tsx index 09a00a1a..56260ab5 100644 --- a/src/components/FunctionalArea/MapNavigation/MapNavigation.component.test.tsx +++ b/src/components/FunctionalArea/MapNavigation/MapNavigation.component.test.tsx @@ -36,18 +36,34 @@ describe('MapNavigation - component', () => { }); const mainMapButton = screen.getByRole('button', { name: 'Main map' }); - const mainMapCloseButton = await within(mainMapButton).queryByTestId('close-icon'); expect(mainMapButton).toBeInTheDocument(); + + const histamineMapButton = screen.getByRole('button', { name: 'Histamine signaling' }); + expect(histamineMapButton).toBeInTheDocument(); + + const prknMapButton = screen.getByRole('button', { name: 'PRKN substrates' }); + expect(prknMapButton).toBeInTheDocument(); + }); + + it('all maps should have close button expect main map', async () => { + renderComponent({ + map: { + data: { ...initialMapDataFixture, openedMaps: openedMapsThreeSubmapsFixture }, + loading: 'succeeded', + error: { message: '', name: '' }, + }, + }); + + const mainMapButton = screen.getByRole('button', { name: 'Main map' }); + const mainMapCloseButton = await within(mainMapButton).queryByTestId('close-icon'); expect(mainMapCloseButton).not.toBeInTheDocument(); const histamineMapButton = screen.getByRole('button', { name: 'Histamine signaling' }); const histamineMapCloseButton = await within(histamineMapButton).getByTestId('close-icon'); - expect(histamineMapButton).toBeInTheDocument(); expect(histamineMapCloseButton).toBeInTheDocument(); const prknMapButton = screen.getByRole('button', { name: 'PRKN substrates' }); const prknMapCloseButton = await within(prknMapButton).getByTestId('close-icon'); - expect(prknMapButton).toBeInTheDocument(); expect(prknMapCloseButton).toBeInTheDocument(); }); -- GitLab