From c6f17b3b1b98b80aae7eb805fb2f2571c2b850b9 Mon Sep 17 00:00:00 2001 From: Yoseph Ahmed Date: Wed, 12 Aug 2020 14:30:28 -0400 Subject: [PATCH] feat: added test cases for visualize route --- src/__tests__/incidents/Incidents.test.tsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/__tests__/incidents/Incidents.test.tsx b/src/__tests__/incidents/Incidents.test.tsx index 41d551c003..43a32abfbe 100644 --- a/src/__tests__/incidents/Incidents.test.tsx +++ b/src/__tests__/incidents/Incidents.test.tsx @@ -9,6 +9,7 @@ import thunk from 'redux-thunk' import Incidents from '../../incidents/Incidents' import ReportIncident from '../../incidents/report/ReportIncident' import ViewIncident from '../../incidents/view/ViewIncident' +import VisualizeIncidents from '../../incidents/visualize/VisualizeIncidents' import IncidentRepository from '../../shared/db/IncidentRepository' import Incident from '../../shared/model/Incident' import Permissions from '../../shared/model/Permissions' @@ -63,6 +64,20 @@ describe('Incidents', () => { }) }) + describe('/incidents/visualize', () => { + it('should render the incident visualize screen when /incidents/visualize is accessed', async () => { + const { wrapper } = await setup([Permissions.ViewIncidentWidgets], '/incidents/visualize') + + expect(wrapper.find(VisualizeIncidents)).toHaveLength(1) + }) + + it('should not navigate to /incidents/visualize if the user does not have ViewIncidentWidgets permissions', async () => { + const { wrapper } = await setup([], '/incidents/visualize') + + expect(wrapper.find(VisualizeIncidents)).toHaveLength(0) + }) + }) + describe('/incidents/:id', () => { it('should render the view incident screen when /incidents/:id is accessed', async () => { const { wrapper } = await setup([Permissions.ViewIncident], '/incidents/1234')