summaryrefslogtreecommitdiff
path: root/spec/frontend/issues/list
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/issues/list')
-rw-r--r--spec/frontend/issues/list/components/issue_card_time_info_spec.js13
-rw-r--r--spec/frontend/issues/list/components/issues_list_app_spec.js27
-rw-r--r--spec/frontend/issues/list/mock_data.js2
3 files changed, 28 insertions, 14 deletions
diff --git a/spec/frontend/issues/list/components/issue_card_time_info_spec.js b/spec/frontend/issues/list/components/issue_card_time_info_spec.js
index e9c48b60da4..c3f13ca6f9a 100644
--- a/spec/frontend/issues/list/components/issue_card_time_info_spec.js
+++ b/spec/frontend/issues/list/components/issue_card_time_info_spec.js
@@ -1,10 +1,11 @@
import { GlIcon, GlLink } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import { useFakeDate } from 'helpers/fake_date';
+import { IssuableStatus } from '~/issues/constants';
import IssueCardTimeInfo from '~/issues/list/components/issue_card_time_info.vue';
describe('CE IssueCardTimeInfo component', () => {
- useFakeDate(2020, 11, 11);
+ useFakeDate(2020, 11, 11); // 2020 Dec 11
let wrapper;
@@ -24,7 +25,7 @@ describe('CE IssueCardTimeInfo component', () => {
const findDueDate = () => wrapper.find('[data-testid="issuable-due-date"]');
const mountComponent = ({
- closedAt = null,
+ state = IssuableStatus.Open,
dueDate = issue.dueDate,
milestoneDueDate = issue.milestone.dueDate,
milestoneStartDate = issue.milestone.startDate,
@@ -38,7 +39,7 @@ describe('CE IssueCardTimeInfo component', () => {
dueDate: milestoneDueDate,
startDate: milestoneStartDate,
},
- closedAt,
+ state,
dueDate,
},
},
@@ -91,7 +92,7 @@ describe('CE IssueCardTimeInfo component', () => {
describe('when in the past', () => {
describe('when issue is open', () => {
it('renders in red', () => {
- wrapper = mountComponent({ dueDate: new Date('2020-10-10') });
+ wrapper = mountComponent({ dueDate: '2020-10-10' });
expect(findDueDate().classes()).toContain('gl-text-red-500');
});
@@ -100,8 +101,8 @@ describe('CE IssueCardTimeInfo component', () => {
describe('when issue is closed', () => {
it('does not render in red', () => {
wrapper = mountComponent({
- dueDate: new Date('2020-10-10'),
- closedAt: '2020-09-05T13:06:25Z',
+ dueDate: '2020-10-10',
+ state: IssuableStatus.Closed,
});
expect(findDueDate().classes()).not.toContain('gl-text-red-500');
diff --git a/spec/frontend/issues/list/components/issues_list_app_spec.js b/spec/frontend/issues/list/components/issues_list_app_spec.js
index 33c7ccac180..5a9bd1ff8e4 100644
--- a/spec/frontend/issues/list/components/issues_list_app_spec.js
+++ b/spec/frontend/issues/list/components/issues_list_app_spec.js
@@ -452,13 +452,26 @@ describe('CE IssuesListApp component', () => {
});
describe('IssuableByEmail component', () => {
- describe.each([true, false])(`when issue creation by email is enabled=%s`, (enabled) => {
- it(`${enabled ? 'renders' : 'does not render'}`, () => {
- wrapper = mountComponent({ provide: { initialEmail: enabled } });
-
- expect(findIssuableByEmail().exists()).toBe(enabled);
- });
- });
+ describe.each`
+ initialEmail | hasAnyIssues | isSignedIn | exists
+ ${false} | ${false} | ${false} | ${false}
+ ${false} | ${true} | ${false} | ${false}
+ ${false} | ${false} | ${true} | ${false}
+ ${false} | ${true} | ${true} | ${false}
+ ${true} | ${false} | ${false} | ${false}
+ ${true} | ${true} | ${false} | ${false}
+ ${true} | ${false} | ${true} | ${true}
+ ${true} | ${true} | ${true} | ${true}
+ `(
+ `when issue creation by email is enabled=$initialEmail`,
+ ({ initialEmail, hasAnyIssues, isSignedIn, exists }) => {
+ it(`${initialEmail ? 'renders' : 'does not render'}`, () => {
+ wrapper = mountComponent({ provide: { initialEmail, hasAnyIssues, isSignedIn } });
+
+ expect(findIssuableByEmail().exists()).toBe(exists);
+ });
+ },
+ );
});
describe('empty states', () => {
diff --git a/spec/frontend/issues/list/mock_data.js b/spec/frontend/issues/list/mock_data.js
index c883b20682e..b1a135ceb18 100644
--- a/spec/frontend/issues/list/mock_data.js
+++ b/spec/frontend/issues/list/mock_data.js
@@ -21,7 +21,6 @@ export const getIssuesQueryResponse = {
__typename: 'Issue',
id: 'gid://gitlab/Issue/123456',
iid: '789',
- closedAt: null,
confidential: false,
createdAt: '2021-05-22T04:08:01Z',
downvotes: 2,
@@ -30,6 +29,7 @@ export const getIssuesQueryResponse = {
humanTimeEstimate: null,
mergeRequestsCount: false,
moved: false,
+ state: 'opened',
title: 'Issue title',
updatedAt: '2021-05-22T04:08:01Z',
upvotes: 3,