Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
feat: added test cases for visualize route
Browse files Browse the repository at this point in the history
  • Loading branch information
yosephAHMED committed Aug 12, 2020
1 parent 9dc7855 commit c6f17b3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/__tests__/incidents/Incidents.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit c6f17b3

Please sign in to comment.