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/javascripts/vue_mr_widget/mr_widget_options_spec.js')
-rw-r--r--spec/javascripts/vue_mr_widget/mr_widget_options_spec.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js b/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js
index 296be43f793..35c1495be58 100644
--- a/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js
+++ b/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js
@@ -94,6 +94,61 @@ describe('mrWidgetOptions', () => {
});
});
+ describe('shouldSuggestPipelines', () => {
+ describe('given suggestPipeline feature flag is enabled', () => {
+ beforeEach(() => {
+ gon.features = { suggestPipeline: true };
+ vm = mountComponent(MrWidgetOptions, {
+ mrData: { ...mockData },
+ });
+ });
+
+ afterEach(() => {
+ gon.features = {};
+ });
+
+ it('should suggest pipelines when none exist', () => {
+ vm.mr.mergeRequestAddCiConfigPath = 'some/path';
+ vm.mr.hasCI = false;
+
+ expect(vm.shouldSuggestPipelines).toBeTruthy();
+ });
+
+ it('should not suggest pipelines when they exist', () => {
+ vm.mr.mergeRequestAddCiConfigPath = null;
+ vm.mr.hasCI = false;
+
+ expect(vm.shouldSuggestPipelines).toBeFalsy();
+ });
+
+ it('should not suggest pipelines hasCI is true', () => {
+ vm.mr.mergeRequestAddCiConfigPath = 'some/path';
+ vm.mr.hasCI = true;
+
+ expect(vm.shouldSuggestPipelines).toBeFalsy();
+ });
+ });
+
+ describe('given suggestPipeline feature flag is not enabled', () => {
+ beforeEach(() => {
+ gon.features = { suggestPipeline: false };
+ vm = mountComponent(MrWidgetOptions, {
+ mrData: { ...mockData },
+ });
+ });
+
+ afterEach(() => {
+ gon.features = {};
+ });
+
+ it('should not suggest pipelines', () => {
+ vm.mr.mergeRequestAddCiConfigPath = null;
+
+ expect(vm.shouldSuggestPipelines).toBeFalsy();
+ });
+ });
+ });
+
describe('shouldRenderRelatedLinks', () => {
it('should return false for the initial data', () => {
expect(vm.shouldRenderRelatedLinks).toBeFalsy();