diff options
author | Jose Ivan Vargas <jvargas@gitlab.com> | 2018-01-18 16:22:20 -0600 |
---|---|---|
committer | Jose Ivan Vargas <jvargas@gitlab.com> | 2018-01-30 09:24:57 -0600 |
commit | 405d8b456f65c7165e8cca83ab0be4c9db6cadd2 (patch) | |
tree | 6240b67f30e37ac5e558cb579366d461a833d628 /spec | |
parent | 03f386c2b20f95272e4846f5ecab54fd8b2566e0 (diff) | |
download | gitlab-ce-405d8b456f65c7165e8cca83ab0be4c9db6cadd2.tar.gz |
Added pipeline status to the files view
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/commit/commit_pipeline_status_component_spec.js | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/spec/javascripts/commit/commit_pipeline_status_component_spec.js b/spec/javascripts/commit/commit_pipeline_status_component_spec.js new file mode 100644 index 00000000000..f6fca9e97e5 --- /dev/null +++ b/spec/javascripts/commit/commit_pipeline_status_component_spec.js @@ -0,0 +1,68 @@ +import Vue from 'vue'; +import MockAdapter from 'axios-mock-adapter'; +import axios from '~/lib/utils/axios_utils'; +import commitPipelineStatus from '~/pages/projects/tree/components/commit_pipeline_status_component.vue'; +import mountComponent from '../helpers/vue_mount_component_helper'; + +describe('Commit pipeline status component', () => { + let vm; + let component; + let mock; + const mockCiStatus = { + details_path: '/root/hello-world/pipelines/1', + favicon: 'canceled.ico', + group: 'canceled', + has_details: true, + icon: 'status_canceled', + label: 'canceled', + text: 'canceled', + }; + + beforeEach(() => { + mock = new MockAdapter(axios); + mock.onGet('/dummy/endpoint').reply(() => { + const res = Promise.resolve([200, { + pipelines: [ + { + details: { + status: mockCiStatus, + }, + }, + ], + }]); + return res; + }); + component = Vue.extend(commitPipelineStatus); + }); + + afterEach(() => { + mock.reset(); + }); + + describe('While polling pipeline data', () => { + beforeEach(() => { + vm = mountComponent(component, { + endpoint: '/dummy/endpoint', + }); + }); + + afterEach(() => { + vm.poll.stop(); + vm.$destroy(); + }); + + it('contains a ciStatus when the polling is succesful ', (done) => { + setTimeout(() => { + expect(vm.ciStatus).toEqual(mockCiStatus); + done(); + }, 1000); + }); + + it('contains a ci-status icon when polling is succesful', (done) => { + setTimeout(() => { + expect(vm.$el.querySelector('.ci-status-icon')).not.toBe(null); + done(); + }); + }); + }); +}); |