Commit 991ffa34 authored by Tristan Read's avatar Tristan Read Committed by Peter Leitzen

Update incident list specs

parent 9fc28484
......@@ -78,6 +78,7 @@ describe('Incidents List', () => {
authorUsernameQuery: '',
assigneeUsernameQuery: '',
slaFeatureAvailable: true,
canCreateIncident: true,
...provide,
},
stubs: {
......@@ -105,21 +106,23 @@ describe('Incidents List', () => {
describe('empty state', () => {
const {
emptyState: { title, emptyClosedTabTitle, description },
emptyState: { title, emptyClosedTabTitle, description, cannotCreateIncidentDescription },
} = I18N;
it.each`
statusFilter | all | closed | expectedTitle | expectedDescription
${'all'} | ${2} | ${1} | ${title} | ${description}
${'open'} | ${2} | ${0} | ${title} | ${description}
${'closed'} | ${0} | ${0} | ${title} | ${description}
${'closed'} | ${2} | ${0} | ${emptyClosedTabTitle} | ${undefined}
statusFilter | all | closed | expectedTitle | canCreateIncident | expectedDescription
${'all'} | ${2} | ${1} | ${title} | ${true} | ${description}
${'open'} | ${2} | ${0} | ${title} | ${true} | ${description}
${'closed'} | ${0} | ${0} | ${title} | ${true} | ${description}
${'closed'} | ${2} | ${0} | ${emptyClosedTabTitle} | ${true} | ${undefined}
${'all'} | ${2} | ${1} | ${title} | ${false} | ${cannotCreateIncidentDescription}
`(
`when active tab is $statusFilter and there are $all incidents in total and $closed closed incidents, the empty state
has title: $expectedTitle and description: $expectedDescription`,
({ statusFilter, all, closed, expectedTitle, expectedDescription }) => {
({ statusFilter, all, closed, expectedTitle, expectedDescription, canCreateIncident }) => {
mountComponent({
data: { incidents: { list: [] }, incidentsCount: { all, closed }, statusFilter },
provide: { canCreateIncident },
loading: false,
});
expect(findEmptyState().exists()).toBe(true);
......@@ -219,6 +222,15 @@ describe('Incidents List', () => {
expect(findCreateIncidentBtn().exists()).toBe(false);
});
it("doesn't show the button when user does not have incident creation permissions", () => {
mountComponent({
data: { incidents: { list: mockIncidents }, incidentsCount: {} },
provide: { canCreateIncident: false },
loading: false,
});
expect(findCreateIncidentBtn().exists()).toBe(false);
});
it('should track create new incident button', async () => {
findCreateIncidentBtn().vm.$emit('click');
await wrapper.vm.$nextTick();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment