diff options
author | Johann Hubert Sonntagbauer <johann.sonntagbauer@gmail.com> | 2018-10-09 20:03:09 +0200 |
---|---|---|
committer | Johann Hubert Sonntagbauer <johann.sonntagbauer@gmail.com> | 2018-10-17 06:57:29 +0200 |
commit | 6f5723a169b5d400c136dbd844fc54c68e5f8563 (patch) | |
tree | e7bad2648366ed5943293655a0abe23367e869a6 /spec/javascripts/pipelines | |
parent | 28d412e5b2b8499fba22e8fabb1d44f44449228e (diff) | |
download | gitlab-ce-6f5723a169b5d400c136dbd844fc54c68e5f8563.tar.gz |
enable jasmine/new-line-before-expect
Diffstat (limited to 'spec/javascripts/pipelines')
8 files changed, 23 insertions, 0 deletions
diff --git a/spec/javascripts/pipelines/pipeline_store_spec.js b/spec/javascripts/pipelines/pipeline_store_spec.js index ab2287cc344..1d5754d1f05 100644 --- a/spec/javascripts/pipelines/pipeline_store_spec.js +++ b/spec/javascripts/pipelines/pipeline_store_spec.js @@ -20,6 +20,7 @@ describe('Pipeline Store', () => { 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 ddd580ae8b7..c9011b403b7 100644 --- a/spec/javascripts/pipelines/pipeline_url_spec.js +++ b/spec/javascripts/pipelines/pipeline_url_spec.js @@ -38,6 +38,7 @@ describe('Pipeline Url Component', () => { expect(component.$el.querySelector('.js-pipeline-url-link').getAttribute('href')).toEqual( 'foo', ); + expect(component.$el.querySelector('.js-pipeline-url-link span').textContent).toEqual('#1'); }); @@ -66,6 +67,7 @@ describe('Pipeline Url Component', () => { expect(component.$el.querySelector('.js-pipeline-url-user').getAttribute('href')).toEqual( mockData.pipeline.user.web_url, ); + expect(image.getAttribute('data-original-title')).toEqual(mockData.pipeline.user.name); expect(image.getAttribute('src')).toEqual(`${mockData.pipeline.user.avatar_url}?width=20`); }); @@ -105,6 +107,7 @@ describe('Pipeline Url Component', () => { expect(component.$el.querySelector('.js-pipeline-url-yaml').textContent).toContain( 'yaml invalid', ); + expect(component.$el.querySelector('.js-pipeline-url-stuck').textContent).toContain('stuck'); }); diff --git a/spec/javascripts/pipelines/pipelines_actions_spec.js b/spec/javascripts/pipelines/pipelines_actions_spec.js index 0566bc55693..b5c62178642 100644 --- a/spec/javascripts/pipelines/pipelines_actions_spec.js +++ b/spec/javascripts/pipelines/pipelines_actions_spec.js @@ -31,11 +31,13 @@ describe('Pipelines Actions dropdown', () => { it('renders a dropdown with the provided actions', () => { const dropdownItems = vm.$el.querySelectorAll('.dropdown-menu li'); + expect(dropdownItems.length).toEqual(actions.length); }); it("renders a disabled action when it's not playable", () => { const dropdownItem = vm.$el.querySelector('.dropdown-menu li:last-child button'); + expect(dropdownItem).toBeDisabled(); }); }); diff --git a/spec/javascripts/pipelines/pipelines_spec.js b/spec/javascripts/pipelines/pipelines_spec.js index ab4c00a79ef..b788049311f 100644 --- a/spec/javascripts/pipelines/pipelines_spec.js +++ b/spec/javascripts/pipelines/pipelines_spec.js @@ -371,18 +371,23 @@ describe('Pipelines', () => { expect( vm.$el.querySelector('.js-pipelines-tab-pending').textContent.trim(), ).toContain('Pending'); + expect( vm.$el.querySelector('.js-pipelines-tab-all').textContent.trim(), ).toContain('All'); + expect( vm.$el.querySelector('.js-pipelines-tab-running').textContent.trim(), ).toContain('Running'); + expect( vm.$el.querySelector('.js-pipelines-tab-finished').textContent.trim(), ).toContain('Finished'); + expect( vm.$el.querySelector('.js-pipelines-tab-branches').textContent.trim(), ).toContain('Branches'); + expect( vm.$el.querySelector('.js-pipelines-tab-tags').textContent.trim(), ).toContain('Tags'); @@ -415,6 +420,7 @@ describe('Pipelines', () => { vm.$nextTick(() => { vm.$el.querySelector('.js-next-button a').click(); + expect(vm.updateContent).toHaveBeenCalledWith({ scope: 'all', page: '2' }); done(); diff --git a/spec/javascripts/pipelines/pipelines_store_spec.js b/spec/javascripts/pipelines/pipelines_store_spec.js index 10ff0c6bb84..ce21f788ed5 100644 --- a/spec/javascripts/pipelines/pipelines_store_spec.js +++ b/spec/javascripts/pipelines/pipelines_store_spec.js @@ -16,12 +16,14 @@ describe('Pipelines Store', () => { 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); }); }); @@ -29,6 +31,7 @@ describe('Pipelines Store', () => { describe('storeCount', () => { it('should use the default parameter if none is provided', () => { store.storeCount(); + expect(store.state.count).toEqual({}); }); @@ -43,6 +46,7 @@ describe('Pipelines Store', () => { describe('storePagination', () => { it('should use the default parameter if none is provided', () => { store.storePagination(); + expect(store.state.pageInfo).toEqual({}); }); @@ -66,6 +70,7 @@ describe('Pipelines Store', () => { }; store.storePagination(pagination); + expect(store.state.pageInfo).toEqual(expectedResult); }); }); diff --git a/spec/javascripts/pipelines/pipelines_table_row_spec.js b/spec/javascripts/pipelines/pipelines_table_row_spec.js index 42795f5c134..fbd87506326 100644 --- a/spec/javascripts/pipelines/pipelines_table_row_spec.js +++ b/spec/javascripts/pipelines/pipelines_table_row_spec.js @@ -37,6 +37,7 @@ describe('Pipelines Table Row', () => { it('should render a table row', () => { component = buildComponent(pipeline); + expect(component.$el.getAttribute('class')).toContain('gl-responsive-table-row'); }); @@ -97,6 +98,7 @@ describe('Pipelines Table Row', () => { component = buildComponent(pipeline); const commitLink = component.$el.querySelector('.branch-commit .commit-sha'); + expect(commitLink.getAttribute('href')).toEqual(pipeline.commit.commit_path); }); @@ -177,6 +179,7 @@ describe('Pipelines Table Row', () => { expect(component.$el.querySelector('.js-pipelines-retry-button')).not.toBeNull(); expect(component.$el.querySelector('.js-pipelines-cancel-button')).not.toBeNull(); const dropdownMenu = component.$el.querySelectorAll('.dropdown-menu'); + expect(dropdownMenu).toContainText(scheduledJobAction.name); }); @@ -186,6 +189,7 @@ describe('Pipelines Table Row', () => { }); component.$el.querySelector('.js-pipelines-retry-button').click(); + expect(component.isRetrying).toEqual(true); }); diff --git a/spec/javascripts/pipelines/pipelines_table_spec.js b/spec/javascripts/pipelines/pipelines_table_spec.js index d21ba35e96d..e0582acb954 100644 --- a/spec/javascripts/pipelines/pipelines_table_spec.js +++ b/spec/javascripts/pipelines/pipelines_table_spec.js @@ -54,6 +54,7 @@ describe('Pipelines Table', () => { viewType: 'root', }, }).$mount(); + expect(component.$el.querySelectorAll('.commit.gl-responsive-table-row').length).toEqual(0); }); }); diff --git a/spec/javascripts/pipelines/stage_spec.js b/spec/javascripts/pipelines/stage_spec.js index 3f6789759ae..7f28f310b43 100644 --- a/spec/javascripts/pipelines/stage_spec.js +++ b/spec/javascripts/pipelines/stage_spec.js @@ -53,6 +53,7 @@ describe('Pipelines stage component', () => { expect( component.$el.querySelector('.js-builds-dropdown-container ul').textContent.trim(), ).toContain(stageReply.latest_statuses[0].name); + expect(eventHub.$emit).toHaveBeenCalledWith('clickedDropdown'); done(); }, 0); |