diff options
Diffstat (limited to 'spec/javascripts/pipelines')
-rw-r--r-- | spec/javascripts/pipelines/blank_state_spec.js | 25 | ||||
-rw-r--r-- | spec/javascripts/pipelines/empty_state_spec.js | 58 | ||||
-rw-r--r-- | spec/javascripts/pipelines/graph/action_component_spec.js | 17 | ||||
-rw-r--r-- | spec/javascripts/pipelines/graph/stage_column_component_spec.js | 4 | ||||
-rw-r--r-- | spec/javascripts/pipelines/pipeline_store_spec.js | 27 | ||||
-rw-r--r-- | spec/javascripts/pipelines/pipeline_url_spec.js | 12 | ||||
-rw-r--r-- | spec/javascripts/pipelines/pipelines_store_spec.js | 77 | ||||
-rw-r--r-- | spec/javascripts/pipelines/stage_spec.js | 16 |
8 files changed, 29 insertions, 207 deletions
diff --git a/spec/javascripts/pipelines/blank_state_spec.js b/spec/javascripts/pipelines/blank_state_spec.js deleted file mode 100644 index 033bd5ccb73..00000000000 --- a/spec/javascripts/pipelines/blank_state_spec.js +++ /dev/null @@ -1,25 +0,0 @@ -import Vue from 'vue'; -import component from '~/pipelines/components/blank_state.vue'; -import mountComponent from '../helpers/vue_mount_component_helper'; - -describe('Pipelines Blank State', () => { - let vm; - let Component; - - beforeEach(() => { - Component = Vue.extend(component); - - vm = mountComponent(Component, { - svgPath: 'foo', - message: 'Blank State', - }); - }); - - it('should render svg', () => { - expect(vm.$el.querySelector('.svg-content img').getAttribute('src')).toEqual('foo'); - }); - - it('should render message', () => { - expect(vm.$el.querySelector('h4').textContent.trim()).toEqual('Blank State'); - }); -}); diff --git a/spec/javascripts/pipelines/empty_state_spec.js b/spec/javascripts/pipelines/empty_state_spec.js deleted file mode 100644 index f12950b8fce..00000000000 --- a/spec/javascripts/pipelines/empty_state_spec.js +++ /dev/null @@ -1,58 +0,0 @@ -import Vue from 'vue'; -import emptyStateComp from '~/pipelines/components/empty_state.vue'; -import mountComponent from '../helpers/vue_mount_component_helper'; - -describe('Pipelines Empty State', () => { - let component; - let EmptyStateComponent; - - beforeEach(() => { - EmptyStateComponent = Vue.extend(emptyStateComp); - - component = mountComponent(EmptyStateComponent, { - helpPagePath: 'foo', - emptyStateSvgPath: 'foo', - canSetCi: true, - }); - }); - - afterEach(() => { - component.$destroy(); - }); - - it('should render empty state SVG', () => { - expect(component.$el.querySelector('.svg-content svg')).toBeDefined(); - }); - - it('should render empty state information', () => { - expect(component.$el.querySelector('h4').textContent).toContain('Build with confidence'); - - expect( - component.$el - .querySelector('p') - .innerHTML.trim() - .replace(/\n+\s+/m, ' ') - .replace(/\s\s+/g, ' '), - ).toContain('Continuous Integration can help catch bugs by running your tests automatically,'); - - expect( - component.$el - .querySelector('p') - .innerHTML.trim() - .replace(/\n+\s+/m, ' ') - .replace(/\s\s+/g, ' '), - ).toContain( - 'while Continuous Deployment can help you deliver code to your product environment', - ); - }); - - it('should render a link with provided help path', () => { - expect(component.$el.querySelector('.js-get-started-pipelines').getAttribute('href')).toEqual( - 'foo', - ); - - expect(component.$el.querySelector('.js-get-started-pipelines').textContent).toContain( - 'Get started with Pipelines', - ); - }); -}); diff --git a/spec/javascripts/pipelines/graph/action_component_spec.js b/spec/javascripts/pipelines/graph/action_component_spec.js index 3d2232ff239..95717d659b8 100644 --- a/spec/javascripts/pipelines/graph/action_component_spec.js +++ b/spec/javascripts/pipelines/graph/action_component_spec.js @@ -55,13 +55,16 @@ describe('pipeline graph action component', () => { component.$el.click(); - component - .$nextTick() - .then(() => { - expect(component.$emit).toHaveBeenCalledWith('pipelineActionRequestComplete'); - }) - .then(done) - .catch(done.fail); + setTimeout(() => { + component + .$nextTick() + .then(() => { + expect(component.$emit).toHaveBeenCalledWith('pipelineActionRequestComplete'); + }) + .catch(done.fail); + + done(); + }, 0); }); }); }); diff --git a/spec/javascripts/pipelines/graph/stage_column_component_spec.js b/spec/javascripts/pipelines/graph/stage_column_component_spec.js index d0b8f877d6f..3240e8e4c1b 100644 --- a/spec/javascripts/pipelines/graph/stage_column_component_spec.js +++ b/spec/javascripts/pipelines/graph/stage_column_component_spec.js @@ -35,6 +35,7 @@ describe('stage column component', () => { component = mountComponent(StageColumnComponent, { title: 'foo', groups: mockGroups, + hasTriggeredBy: false, }); }); @@ -54,13 +55,14 @@ describe('stage column component', () => { id: 4259, name: '<img src=x onerror=alert(document.domain)>', status: { - icon: 'icon_status_success', + icon: 'status_success', label: 'success', tooltip: '<img src=x onerror=alert(document.domain)>', }, }, ], title: 'test', + hasTriggeredBy: false, }); expect(component.$el.querySelector('.builds-container li').getAttribute('id')).toEqual( diff --git a/spec/javascripts/pipelines/pipeline_store_spec.js b/spec/javascripts/pipelines/pipeline_store_spec.js deleted file mode 100644 index 1d5754d1f05..00000000000 --- a/spec/javascripts/pipelines/pipeline_store_spec.js +++ /dev/null @@ -1,27 +0,0 @@ -import PipelineStore from '~/pipelines/stores/pipeline_store'; - -describe('Pipeline Store', () => { - let store; - - beforeEach(() => { - store = new PipelineStore(); - }); - - it('should set defaults', () => { - expect(store.state.pipeline).toEqual({}); - }); - - describe('storePipeline', () => { - it('should store empty object if none is provided', () => { - store.storePipeline(); - - expect(store.state.pipeline).toEqual({}); - }); - - it('should store received object', () => { - store.storePipeline({ foo: 'bar' }); - - expect(store.state.pipeline).toEqual({ foo: 'bar' }); - }); - }); -}); diff --git a/spec/javascripts/pipelines/pipeline_url_spec.js b/spec/javascripts/pipelines/pipeline_url_spec.js index ea917b36526..faad49a78b0 100644 --- a/spec/javascripts/pipelines/pipeline_url_spec.js +++ b/spec/javascripts/pipelines/pipeline_url_spec.js @@ -100,7 +100,8 @@ describe('Pipeline Url Component', () => { latest: true, yaml_errors: true, stuck: true, - merge_request: true, + merge_request_pipeline: true, + detached_merge_request_pipeline: true, }, }, autoDevopsHelpPath: 'foo', @@ -108,15 +109,16 @@ describe('Pipeline Url Component', () => { }).$mount(); expect(component.$el.querySelector('.js-pipeline-url-latest').textContent).toContain('latest'); + expect(component.$el.querySelector('.js-pipeline-url-yaml').textContent).toContain( 'yaml invalid', ); - expect(component.$el.querySelector('.js-pipeline-url-mergerequest').textContent).toContain( - 'merge request', - ); - expect(component.$el.querySelector('.js-pipeline-url-stuck').textContent).toContain('stuck'); + + expect(component.$el.querySelector('.js-pipeline-url-detached').textContent).toContain( + 'detached', + ); }); it('should render a badge for autodevops', () => { diff --git a/spec/javascripts/pipelines/pipelines_store_spec.js b/spec/javascripts/pipelines/pipelines_store_spec.js deleted file mode 100644 index ce21f788ed5..00000000000 --- a/spec/javascripts/pipelines/pipelines_store_spec.js +++ /dev/null @@ -1,77 +0,0 @@ -import PipelineStore from '~/pipelines/stores/pipelines_store'; - -describe('Pipelines Store', () => { - let store; - - beforeEach(() => { - store = new PipelineStore(); - }); - - it('should be initialized with an empty state', () => { - expect(store.state.pipelines).toEqual([]); - expect(store.state.count).toEqual({}); - expect(store.state.pageInfo).toEqual({}); - }); - - describe('storePipelines', () => { - it('should use the default parameter if none is provided', () => { - store.storePipelines(); - - expect(store.state.pipelines).toEqual([]); - }); - - it('should store the provided array', () => { - const array = [{ id: 1, status: 'running' }, { id: 2, status: 'success' }]; - store.storePipelines(array); - - expect(store.state.pipelines).toEqual(array); - }); - }); - - describe('storeCount', () => { - it('should use the default parameter if none is provided', () => { - store.storeCount(); - - expect(store.state.count).toEqual({}); - }); - - it('should store the provided count', () => { - const count = { all: 20, finished: 10 }; - store.storeCount(count); - - expect(store.state.count).toEqual(count); - }); - }); - - describe('storePagination', () => { - it('should use the default parameter if none is provided', () => { - store.storePagination(); - - expect(store.state.pageInfo).toEqual({}); - }); - - it('should store pagination information normalized and parsed', () => { - const pagination = { - 'X-nExt-pAge': '2', - 'X-page': '1', - 'X-Per-Page': '1', - 'X-Prev-Page': '2', - 'X-TOTAL': '37', - 'X-Total-Pages': '2', - }; - - const expectedResult = { - perPage: 1, - page: 1, - total: 37, - totalPages: 2, - nextPage: 2, - previousPage: 2, - }; - - store.storePagination(pagination); - - expect(store.state.pageInfo).toEqual(expectedResult); - }); - }); -}); diff --git a/spec/javascripts/pipelines/stage_spec.js b/spec/javascripts/pipelines/stage_spec.js index 3c8b8032de8..19ae7860333 100644 --- a/spec/javascripts/pipelines/stage_spec.js +++ b/spec/javascripts/pipelines/stage_spec.js @@ -120,13 +120,15 @@ describe('Pipelines stage component', () => { setTimeout(() => { component.$el.querySelector('.js-ci-action').click(); - component - .$nextTick() - .then(() => { - expect(eventHub.$emit).toHaveBeenCalledWith('refreshPipelinesTable'); - }) - .then(done) - .catch(done.fail); + setTimeout(() => { + component + .$nextTick() + .then(() => { + expect(eventHub.$emit).toHaveBeenCalledWith('refreshPipelinesTable'); + }) + .then(done) + .catch(done.fail); + }, 0); }, 0); }); }); |