summaryrefslogtreecommitdiff
path: root/spec/frontend/work_items/router_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/work_items/router_spec.js')
-rw-r--r--spec/frontend/work_items/router_spec.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/frontend/work_items/router_spec.js b/spec/frontend/work_items/router_spec.js
index 66a917d8052..982f9f71f9e 100644
--- a/spec/frontend/work_items/router_spec.js
+++ b/spec/frontend/work_items/router_spec.js
@@ -10,6 +10,8 @@ import {
workItemTitleSubscriptionResponse,
workItemWeightSubscriptionResponse,
workItemLabelsSubscriptionResponse,
+ workItemMilestoneSubscriptionResponse,
+ workItemDescriptionSubscriptionResponse,
} from 'jest/work_items/mock_data';
import App from '~/work_items/components/app.vue';
import workItemQuery from '~/work_items/graphql/work_item.query.graphql';
@@ -17,6 +19,8 @@ import workItemDatesSubscription from '~/work_items/graphql/work_item_dates.subs
import workItemTitleSubscription from '~/work_items/graphql/work_item_title.subscription.graphql';
import workItemAssigneesSubscription from '~/work_items/graphql/work_item_assignees.subscription.graphql';
import workItemLabelsSubscription from 'ee_else_ce/work_items/graphql/work_item_labels.subscription.graphql';
+import workItemMilestoneSubscription from '~/work_items/graphql/work_item_milestone.subscription.graphql';
+import workItemDescriptionSubscription from '~/work_items/graphql/work_item_description.subscription.graphql';
import CreateWorkItem from '~/work_items/pages/create_work_item.vue';
import WorkItemsRoot from '~/work_items/pages/work_item_root.vue';
import { createRouter } from '~/work_items/router';
@@ -34,6 +38,12 @@ describe('Work items router', () => {
.fn()
.mockResolvedValue(workItemAssigneesSubscriptionResponse);
const labelsSubscriptionHandler = jest.fn().mockResolvedValue(workItemLabelsSubscriptionResponse);
+ const milestoneSubscriptionHandler = jest
+ .fn()
+ .mockResolvedValue(workItemMilestoneSubscriptionResponse);
+ const descriptionSubscriptionHandler = jest
+ .fn()
+ .mockResolvedValue(workItemDescriptionSubscriptionResponse);
const createComponent = async (routeArg) => {
const router = createRouter('/work_item');
@@ -47,6 +57,8 @@ describe('Work items router', () => {
[workItemTitleSubscription, titleSubscriptionHandler],
[workItemAssigneesSubscription, assigneesSubscriptionHandler],
[workItemLabelsSubscription, labelsSubscriptionHandler],
+ [workItemMilestoneSubscription, milestoneSubscriptionHandler],
+ [workItemDescriptionSubscription, descriptionSubscriptionHandler],
];
if (IS_EE) {
@@ -59,10 +71,19 @@ describe('Work items router', () => {
provide: {
fullPath: 'full-path',
issuesListPath: 'full-path/-/issues',
+ hasIssueWeightsFeature: false,
},
});
};
+ beforeEach(() => {
+ window.gon = {
+ features: {
+ workItemsMvc2: false,
+ },
+ };
+ });
+
afterEach(() => {
wrapper.destroy();
window.location.hash = '';
@@ -74,7 +95,14 @@ describe('Work items router', () => {
expect(wrapper.findComponent(WorkItemsRoot).exists()).toBe(true);
});
+ it('does not render create work item page on `/new` route if `workItemsMvc2` feature flag is off', async () => {
+ await createComponent('/new');
+
+ expect(wrapper.findComponent(CreateWorkItem).exists()).toBe(false);
+ });
+
it('renders create work item page on `/new` route', async () => {
+ window.gon.features.workItemsMvc2 = true;
await createComponent('/new');
expect(wrapper.findComponent(CreateWorkItem).exists()).toBe(true);