summaryrefslogtreecommitdiff
path: root/spec/javascripts/vue_mr_widget/stores
diff options
context:
space:
mode:
authorEric Eastwood <contact@ericeastwood.com>2017-08-31 19:46:18 -0500
committerEric Eastwood <contact@ericeastwood.com>2017-09-18 18:06:39 -0500
commit5ecfd3cd0f6be51d4e01292b0c5583427d73aa8d (patch)
treef51e560435c96326f07dd7c6a623172b9679390c /spec/javascripts/vue_mr_widget/stores
parentf0b089cf7881a0eed7f3aefe22d5b3006a39023d (diff)
downloadgitlab-ce-5ecfd3cd0f6be51d4e01292b0c5583427d73aa8d.tar.gz
Fix MR widget with external CI services/integrations33287-fix-mr-widget-errors-with-external-services
Fix https://gitlab.com/gitlab-org/gitlab-ce/issues/33287 The MR widget was trying to render the pipelines section when there are no GitLab CI pipelines which was throwing some NPE errors.
Diffstat (limited to 'spec/javascripts/vue_mr_widget/stores')
-rw-r--r--spec/javascripts/vue_mr_widget/stores/mr_widget_store_spec.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/javascripts/vue_mr_widget/stores/mr_widget_store_spec.js b/spec/javascripts/vue_mr_widget/stores/mr_widget_store_spec.js
index 56dd0198ae2..8e5614b20f0 100644
--- a/spec/javascripts/vue_mr_widget/stores/mr_widget_store_spec.js
+++ b/spec/javascripts/vue_mr_widget/stores/mr_widget_store_spec.js
@@ -18,5 +18,39 @@ describe('MergeRequestStore', () => {
store.setData({ ...mockData, work_in_progress: !mockData.work_in_progress });
expect(store.hasSHAChanged).toBe(false);
});
+
+ describe('isPipelinePassing', () => {
+ it('is true when the CI status is `success`', () => {
+ store.setData({ ...mockData, ci_status: 'success' });
+ expect(store.isPipelinePassing).toBe(true);
+ });
+
+ it('is true when the CI status is `success_with_warnings`', () => {
+ store.setData({ ...mockData, ci_status: 'success_with_warnings' });
+ expect(store.isPipelinePassing).toBe(true);
+ });
+
+ it('is false when the CI status is `failed`', () => {
+ store.setData({ ...mockData, ci_status: 'failed' });
+ expect(store.isPipelinePassing).toBe(false);
+ });
+
+ it('is false when the CI status is anything except `success`', () => {
+ store.setData({ ...mockData, ci_status: 'foobarbaz' });
+ expect(store.isPipelinePassing).toBe(false);
+ });
+ });
+
+ describe('isPipelineSkipped', () => {
+ it('should set isPipelineSkipped=true when the CI status is `skipped`', () => {
+ store.setData({ ...mockData, ci_status: 'skipped' });
+ expect(store.isPipelineSkipped).toBe(true);
+ });
+
+ it('should set isPipelineSkipped=false when the CI status is anything except `skipped`', () => {
+ store.setData({ ...mockData, ci_status: 'foobarbaz' });
+ expect(store.isPipelineSkipped).toBe(false);
+ });
+ });
});
});