summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwinh <winnie@gitlab.com>2017-06-23 09:29:17 +0200
committerwinh <winnie@gitlab.com>2017-06-26 17:43:29 +0200
commit1fc9262e3dc1cd56ab7867aa9ce1f296e1d4aed4 (patch)
tree232282966d7eca768734f76be4ae993745c2f3b3
parent50fffb5ff6838f723df43884eeb5ead798e97453 (diff)
downloadgitlab-ce-1fc9262e3dc1cd56ab7867aa9ce1f296e1d4aed4.tar.gz
Handle Promise rejections in mr_widget_pipeline_spec.js
-rw-r--r--spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_spec.js59
1 files changed, 35 insertions, 24 deletions
diff --git a/spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_spec.js b/spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_spec.js
index 0ffa4ac46e3..4b6f171c8d6 100644
--- a/spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_spec.js
+++ b/spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_spec.js
@@ -86,12 +86,15 @@ describe('MRWidgetPipeline', () => {
});
it('should render message with spinner', (done) => {
- Vue.nextTick(() => {
- expect(el.querySelector('.pipeline-id')).toBe(null);
- expect(el.innerText.trim()).toBe('Waiting for pipeline...');
- expect(el.querySelectorAll('i.fa.fa-spinner.fa-spin').length).toBe(1);
- done();
- });
+ Vue.nextTick()
+ .then(() => {
+ expect(el.querySelector('.pipeline-id')).toBe(null);
+ expect(el.innerText.trim()).toBe('Waiting for pipeline...');
+ expect(el.querySelectorAll('i.fa.fa-spinner.fa-spin').length).toBe(1);
+ done();
+ })
+ .then(done)
+ .catch(done.fail);
});
});
@@ -112,39 +115,47 @@ describe('MRWidgetPipeline', () => {
it('should list single stage', (done) => {
pipeline.details.stages.splice(0, 1);
- Vue.nextTick(() => {
- expect(el.querySelectorAll('.stage-container button').length).toEqual(1);
- expect(el.innerText).toContain('with stage');
- done();
- });
+ Vue.nextTick()
+ .then(() => {
+ expect(el.querySelectorAll('.stage-container button').length).toEqual(1);
+ expect(el.innerText).toContain('with stage');
+ })
+ .then(done)
+ .catch(done.fail);
});
it('should not have stages when there is no stage', (done) => {
vm.mr.pipeline.details.stages = [];
- Vue.nextTick(() => {
- expect(el.querySelectorAll('.stage-container button').length).toEqual(0);
- done();
- });
+ Vue.nextTick()
+ .then(() => {
+ expect(el.querySelectorAll('.stage-container button').length).toEqual(0);
+ })
+ .then(done)
+ .catch(done.fail);
});
it('should not have coverage text when pipeline has no coverage info', (done) => {
vm.mr.pipeline.coverage = null;
- Vue.nextTick(() => {
- expect(el.querySelector('.js-mr-coverage')).toEqual(null);
- done();
- });
+ Vue.nextTick()
+ .then(() => {
+ expect(el.querySelector('.js-mr-coverage')).toEqual(null);
+ })
+ .then(done)
+ .catch(done.fail);
});
it('should show CI error when there is a CI error', (done) => {
vm.mr.ciStatus = null;
- Vue.nextTick(() => {
- expect(el.querySelectorAll('.js-ci-error').length).toEqual(1);
- expect(el.innerText).toContain('Could not connect to the CI server');
- done();
- });
+ Vue.nextTick()
+ .then(() => {
+ expect(el.querySelectorAll('.js-ci-error').length).toEqual(1);
+ expect(el.innerText).toContain('Could not connect to the CI server');
+ })
+ .then(done)
+ .catch(done.fail);
});
});
});