Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/work_items/components/work_item_weight_spec.js')
-rw-r--r--spec/frontend/work_items/components/work_item_weight_spec.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/frontend/work_items/components/work_item_weight_spec.js b/spec/frontend/work_items/components/work_item_weight_spec.js
new file mode 100644
index 00000000000..80a1d032ad7
--- /dev/null
+++ b/spec/frontend/work_items/components/work_item_weight_spec.js
@@ -0,0 +1,47 @@
+import { shallowMount } from '@vue/test-utils';
+import WorkItemWeight from '~/work_items/components/work_item_weight.vue';
+
+describe('WorkItemAssignees component', () => {
+ let wrapper;
+
+ const createComponent = ({ weight, hasIssueWeightsFeature = true } = {}) => {
+ wrapper = shallowMount(WorkItemWeight, {
+ propsData: {
+ weight,
+ },
+ provide: {
+ hasIssueWeightsFeature,
+ },
+ });
+ };
+
+ describe('weight licensed feature', () => {
+ describe.each`
+ description | hasIssueWeightsFeature | exists
+ ${'when available'} | ${true} | ${true}
+ ${'when not available'} | ${false} | ${false}
+ `('$description', ({ hasIssueWeightsFeature, exists }) => {
+ it(hasIssueWeightsFeature ? 'renders component' : 'does not render component', () => {
+ createComponent({ hasIssueWeightsFeature });
+
+ expect(wrapper.find('div').exists()).toBe(exists);
+ });
+ });
+ });
+
+ describe('weight text', () => {
+ describe.each`
+ description | weight | text
+ ${'renders 1'} | ${1} | ${'1'}
+ ${'renders 0'} | ${0} | ${'0'}
+ ${'renders None'} | ${null} | ${'None'}
+ ${'renders None'} | ${undefined} | ${'None'}
+ `('when weight is $weight', ({ description, weight, text }) => {
+ it(description, () => {
+ createComponent({ weight });
+
+ expect(wrapper.text()).toContain(text);
+ });
+ });
+ });
+});