From f666026d71ebefd70219d5078b1f0c83fa01f84d Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Wed, 17 Oct 2018 02:13:26 -0500 Subject: Prettify all spec files --- spec/javascripts/pipelines/blank_state_spec.js | 14 +- spec/javascripts/pipelines/empty_state_spec.js | 24 ++- .../pipelines/graph/action_component_spec.js | 16 +- spec/javascripts/pipelines/graph/job_item_spec.js | 36 ++-- .../javascripts/pipelines/header_component_spec.js | 7 +- spec/javascripts/pipelines/nav_controls_spec.js | 12 +- .../pipelines/pipelines_artifacts_spec.js | 16 +- spec/javascripts/pipelines/pipelines_spec.js | 193 ++++++++++++--------- .../pipelines/pipelines_table_row_spec.js | 3 +- spec/javascripts/pipelines/pipelines_table_spec.js | 16 +- spec/javascripts/pipelines/stage_spec.js | 13 +- 11 files changed, 208 insertions(+), 142 deletions(-) (limited to 'spec/javascripts/pipelines') diff --git a/spec/javascripts/pipelines/blank_state_spec.js b/spec/javascripts/pipelines/blank_state_spec.js index b7a9b60d85c..033bd5ccb73 100644 --- a/spec/javascripts/pipelines/blank_state_spec.js +++ b/spec/javascripts/pipelines/blank_state_spec.js @@ -9,12 +9,10 @@ describe('Pipelines Blank State', () => { beforeEach(() => { Component = Vue.extend(component); - vm = mountComponent(Component, - { - svgPath: 'foo', - message: 'Blank State', - }, - ); + vm = mountComponent(Component, { + svgPath: 'foo', + message: 'Blank State', + }); }); it('should render svg', () => { @@ -22,8 +20,6 @@ describe('Pipelines Blank State', () => { }); it('should render message', () => { - expect( - vm.$el.querySelector('h4').textContent.trim(), - ).toEqual('Blank State'); + 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 index 1e41a7bfe7c..8cd3d9c64d5 100644 --- a/spec/javascripts/pipelines/empty_state_spec.js +++ b/spec/javascripts/pipelines/empty_state_spec.js @@ -28,16 +28,30 @@ describe('Pipelines Empty State', () => { 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, ' '), + 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'); + 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'); + 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 568e679abe9..027066e1d4d 100644 --- a/spec/javascripts/pipelines/graph/action_component_spec.js +++ b/spec/javascripts/pipelines/graph/action_component_spec.js @@ -35,12 +35,13 @@ describe('pipeline graph action component', () => { it('should update bootstrap tooltip when title changes', done => { component.tooltipText = 'changed'; - component.$nextTick() - .then(() => { - expect(component.$el.getAttribute('data-original-title')).toBe('changed'); - }) - .then(done) - .catch(done.fail); + component + .$nextTick() + .then(() => { + expect(component.$el.getAttribute('data-original-title')).toBe('changed'); + }) + .then(done) + .catch(done.fail); }); it('should render an svg', () => { @@ -54,7 +55,8 @@ describe('pipeline graph action component', () => { component.$el.click(); - component.$nextTick() + component + .$nextTick() .then(() => { expect(component.$emit).toHaveBeenCalledWith('pipelineActionRequestComplete'); }) diff --git a/spec/javascripts/pipelines/graph/job_item_spec.js b/spec/javascripts/pipelines/graph/job_item_spec.js index 88bc4676699..7cbcdc791e7 100644 --- a/spec/javascripts/pipelines/graph/job_item_spec.js +++ b/spec/javascripts/pipelines/graph/job_item_spec.js @@ -31,7 +31,7 @@ describe('pipeline graph job item', () => { }); describe('name with link', () => { - it('should render the job name and status with a link', (done) => { + it('should render the job name and status with a link', done => { component = mountComponent(JobComponent, { job: mockJob }); Vue.nextTick(() => { @@ -39,15 +39,15 @@ describe('pipeline graph job item', () => { expect(link.getAttribute('href')).toEqual(mockJob.status.details_path); - expect( - link.getAttribute('data-original-title'), - ).toEqual(`${mockJob.name} - ${mockJob.status.label}`); + expect(link.getAttribute('data-original-title')).toEqual( + `${mockJob.name} - ${mockJob.status.label}`, + ); expect(component.$el.querySelector('.js-status-icon-success')).toBeDefined(); - expect( - component.$el.querySelector('.ci-status-text').textContent.trim(), - ).toEqual(mockJob.name); + expect(component.$el.querySelector('.ci-status-text').textContent.trim()).toEqual( + mockJob.name, + ); done(); }); @@ -74,9 +74,9 @@ describe('pipeline graph job item', () => { expect(component.$el.querySelector('.js-status-icon-success')).toBeDefined(); expect(component.$el.querySelector('a')).toBeNull(); - expect( - component.$el.querySelector('.ci-status-text').textContent.trim(), - ).toEqual(mockJob.name); + expect(component.$el.querySelector('.ci-status-text').textContent.trim()).toEqual( + mockJob.name, + ); }); }); @@ -95,9 +95,7 @@ describe('pipeline graph job item', () => { cssClassJobName: 'css-class-job-name', }); - expect( - component.$el.querySelector('a').classList.contains('css-class-job-name'), - ).toBe(true); + expect(component.$el.querySelector('a').classList.contains('css-class-job-name')).toBe(true); }); describe('status label', () => { @@ -112,7 +110,11 @@ describe('pipeline graph job item', () => { }, }); - expect(component.$el.querySelector('.js-job-component-tooltip').getAttribute('data-original-title')).toEqual('test'); + expect( + component.$el + .querySelector('.js-job-component-tooltip') + .getAttribute('data-original-title'), + ).toEqual('test'); }); it('should not render status label when it is provided', () => { @@ -128,7 +130,11 @@ describe('pipeline graph job item', () => { }, }); - expect(component.$el.querySelector('.js-job-component-tooltip').getAttribute('data-original-title')).toEqual('test - success'); + expect( + component.$el + .querySelector('.js-job-component-tooltip') + .getAttribute('data-original-title'), + ).toEqual('test - success'); }); }); diff --git a/spec/javascripts/pipelines/header_component_spec.js b/spec/javascripts/pipelines/header_component_spec.js index 034d3b4957d..473a062fc40 100644 --- a/spec/javascripts/pipelines/header_component_spec.js +++ b/spec/javascripts/pipelines/header_component_spec.js @@ -47,13 +47,16 @@ describe('Pipeline details header', () => { it('should render provided pipeline info', () => { expect( - vm.$el.querySelector('.header-main-content').textContent.replace(/\s+/g, ' ').trim(), + vm.$el + .querySelector('.header-main-content') + .textContent.replace(/\s+/g, ' ') + .trim(), ).toEqual('failed Pipeline #123 triggered 3 weeks ago by Foo'); }); describe('action buttons', () => { it('should call postAction when button action is clicked', () => { - eventHub.$on('headerPostAction', (action) => { + eventHub.$on('headerPostAction', action => { expect(action.path).toEqual('path'); }); diff --git a/spec/javascripts/pipelines/nav_controls_spec.js b/spec/javascripts/pipelines/nav_controls_spec.js index d6232f5c567..7806cdf1477 100644 --- a/spec/javascripts/pipelines/nav_controls_spec.js +++ b/spec/javascripts/pipelines/nav_controls_spec.js @@ -24,7 +24,9 @@ describe('Pipelines Nav Controls', () => { component = mountComponent(NavControlsComponent, mockData); expect(component.$el.querySelector('.js-run-pipeline').textContent).toContain('Run Pipeline'); - expect(component.$el.querySelector('.js-run-pipeline').getAttribute('href')).toEqual(mockData.newPipelinePath); + expect(component.$el.querySelector('.js-run-pipeline').getAttribute('href')).toEqual( + mockData.newPipelinePath, + ); }); it('should not render link to create pipeline if no path is provided', () => { @@ -50,7 +52,9 @@ describe('Pipelines Nav Controls', () => { component = mountComponent(NavControlsComponent, mockData); expect(component.$el.querySelector('.js-ci-lint').textContent.trim()).toContain('CI Lint'); - expect(component.$el.querySelector('.js-ci-lint').getAttribute('href')).toEqual(mockData.ciLintPath); + expect(component.$el.querySelector('.js-ci-lint').getAttribute('href')).toEqual( + mockData.ciLintPath, + ); }); describe('Reset Runners Cache', () => { @@ -65,7 +69,9 @@ describe('Pipelines Nav Controls', () => { }); it('should render button for resetting runner caches', () => { - expect(component.$el.querySelector('.js-clear-cache').textContent.trim()).toContain('Clear Runner Caches'); + expect(component.$el.querySelector('.js-clear-cache').textContent.trim()).toContain( + 'Clear Runner Caches', + ); }); it('should emit postAction event when reset runner cache button is clicked', () => { diff --git a/spec/javascripts/pipelines/pipelines_artifacts_spec.js b/spec/javascripts/pipelines/pipelines_artifacts_spec.js index a8a8e3e2cff..7705d5a19bf 100644 --- a/spec/javascripts/pipelines/pipelines_artifacts_spec.js +++ b/spec/javascripts/pipelines/pipelines_artifacts_spec.js @@ -23,18 +23,16 @@ describe('Pipelines Artifacts dropdown', () => { }); it('should render a dropdown with the provided artifacts', () => { - expect( - component.$el.querySelectorAll('.dropdown-menu li').length, - ).toEqual(artifacts.length); + expect(component.$el.querySelectorAll('.dropdown-menu li').length).toEqual(artifacts.length); }); it('should render a link with the provided path', () => { - expect( - component.$el.querySelector('.dropdown-menu li a').getAttribute('href'), - ).toEqual(artifacts[0].path); + expect(component.$el.querySelector('.dropdown-menu li a').getAttribute('href')).toEqual( + artifacts[0].path, + ); - expect( - component.$el.querySelector('.dropdown-menu li a').textContent, - ).toContain(artifacts[0].name); + expect(component.$el.querySelector('.dropdown-menu li a').textContent).toContain( + artifacts[0].name, + ); }); }); diff --git a/spec/javascripts/pipelines/pipelines_spec.js b/spec/javascripts/pipelines/pipelines_spec.js index b788049311f..3a3f9368bb4 100644 --- a/spec/javascripts/pipelines/pipelines_spec.js +++ b/spec/javascripts/pipelines/pipelines_spec.js @@ -52,7 +52,7 @@ describe('Pipelines', () => { describe('With permission', () => { describe('With pipelines in main tab', () => { - beforeEach((done) => { + beforeEach(done => { mock.onGet('twitter/flight/pipelines.json').reply(200, pipelines); vm = mountComponent(PipelinesComponent, { @@ -72,7 +72,9 @@ describe('Pipelines', () => { }); it('renders Run Pipeline link', () => { - expect(vm.$el.querySelector('.js-run-pipeline').getAttribute('href')).toEqual(paths.newPipelinePath); + expect(vm.$el.querySelector('.js-run-pipeline').getAttribute('href')).toEqual( + paths.newPipelinePath, + ); }); it('renders CI Lint link', () => { @@ -80,18 +82,20 @@ describe('Pipelines', () => { }); it('renders Clear Runner Cache button', () => { - expect(vm.$el.querySelector('.js-clear-cache').textContent.trim()).toEqual('Clear Runner Caches'); + expect(vm.$el.querySelector('.js-clear-cache').textContent.trim()).toEqual( + 'Clear Runner Caches', + ); }); it('renders pipelines table', () => { - expect( - vm.$el.querySelectorAll('.gl-responsive-table-row').length, - ).toEqual(pipelines.pipelines.length + 1); + expect(vm.$el.querySelectorAll('.gl-responsive-table-row').length).toEqual( + pipelines.pipelines.length + 1, + ); }); }); describe('Without pipelines on main tab with CI', () => { - beforeEach((done) => { + beforeEach(done => { mock.onGet('twitter/flight/pipelines.json').reply(200, { pipelines: [], count: { @@ -118,7 +122,9 @@ describe('Pipelines', () => { }); it('renders Run Pipeline link', () => { - expect(vm.$el.querySelector('.js-run-pipeline').getAttribute('href')).toEqual(paths.newPipelinePath); + expect(vm.$el.querySelector('.js-run-pipeline').getAttribute('href')).toEqual( + paths.newPipelinePath, + ); }); it('renders CI Lint link', () => { @@ -126,16 +132,20 @@ describe('Pipelines', () => { }); it('renders Clear Runner Cache button', () => { - expect(vm.$el.querySelector('.js-clear-cache').textContent.trim()).toEqual('Clear Runner Caches'); + expect(vm.$el.querySelector('.js-clear-cache').textContent.trim()).toEqual( + 'Clear Runner Caches', + ); }); it('renders tab empty state', () => { - expect(vm.$el.querySelector('.empty-state h4').textContent.trim()).toEqual('There are currently no pipelines.'); + expect(vm.$el.querySelector('.empty-state h4').textContent.trim()).toEqual( + 'There are currently no pipelines.', + ); }); }); describe('Without pipelines nor CI', () => { - beforeEach((done) => { + beforeEach(done => { mock.onGet('twitter/flight/pipelines.json').reply(200, { pipelines: [], count: { @@ -158,8 +168,12 @@ describe('Pipelines', () => { }); it('renders empty state', () => { - expect(vm.$el.querySelector('.js-empty-state h4').textContent.trim()).toEqual('Build with confidence'); - expect(vm.$el.querySelector('.js-get-started-pipelines').getAttribute('href')).toEqual(paths.helpPagePath); + expect(vm.$el.querySelector('.js-empty-state h4').textContent.trim()).toEqual( + 'Build with confidence', + ); + expect(vm.$el.querySelector('.js-get-started-pipelines').getAttribute('href')).toEqual( + paths.helpPagePath, + ); }); it('does not render tabs nor buttons', () => { @@ -171,7 +185,7 @@ describe('Pipelines', () => { }); describe('When API returns error', () => { - beforeEach((done) => { + beforeEach(done => { mock.onGet('twitter/flight/pipelines.json').reply(500, {}); vm = mountComponent(PipelinesComponent, { store: new Store(), @@ -190,20 +204,26 @@ describe('Pipelines', () => { }); it('renders buttons', () => { - expect(vm.$el.querySelector('.js-run-pipeline').getAttribute('href')).toEqual(paths.newPipelinePath); + expect(vm.$el.querySelector('.js-run-pipeline').getAttribute('href')).toEqual( + paths.newPipelinePath, + ); expect(vm.$el.querySelector('.js-ci-lint').getAttribute('href')).toEqual(paths.ciLintPath); - expect(vm.$el.querySelector('.js-clear-cache').textContent.trim()).toEqual('Clear Runner Caches'); + expect(vm.$el.querySelector('.js-clear-cache').textContent.trim()).toEqual( + 'Clear Runner Caches', + ); }); it('renders error state', () => { - expect(vm.$el.querySelector('.empty-state').textContent.trim()).toContain('There was an error fetching the pipelines.'); + expect(vm.$el.querySelector('.empty-state').textContent.trim()).toContain( + 'There was an error fetching the pipelines.', + ); }); }); }); describe('Without permission', () => { describe('With pipelines in main tab', () => { - beforeEach((done) => { + beforeEach(done => { mock.onGet('twitter/flight/pipelines.json').reply(200, pipelines); vm = mountComponent(PipelinesComponent, { @@ -229,14 +249,14 @@ describe('Pipelines', () => { }); it('renders pipelines table', () => { - expect( - vm.$el.querySelectorAll('.gl-responsive-table-row').length, - ).toEqual(pipelines.pipelines.length + 1); + expect(vm.$el.querySelectorAll('.gl-responsive-table-row').length).toEqual( + pipelines.pipelines.length + 1, + ); }); }); describe('Without pipelines on main tab with CI', () => { - beforeEach((done) => { + beforeEach(done => { mock.onGet('twitter/flight/pipelines.json').reply(200, { pipelines: [], count: { @@ -270,12 +290,14 @@ describe('Pipelines', () => { }); it('renders tab empty state', () => { - expect(vm.$el.querySelector('.empty-state h4').textContent.trim()).toEqual('There are currently no pipelines.'); + expect(vm.$el.querySelector('.empty-state h4').textContent.trim()).toEqual( + 'There are currently no pipelines.', + ); }); }); describe('Without pipelines nor CI', () => { - beforeEach((done) => { + beforeEach(done => { mock.onGet('twitter/flight/pipelines.json').reply(200, { pipelines: [], count: { @@ -299,7 +321,9 @@ describe('Pipelines', () => { }); it('renders empty state without button to set CI', () => { - expect(vm.$el.querySelector('.js-empty-state').textContent.trim()).toEqual('This project is not currently set up to run pipelines.'); + expect(vm.$el.querySelector('.js-empty-state').textContent.trim()).toEqual( + 'This project is not currently set up to run pipelines.', + ); expect(vm.$el.querySelector('.js-get-started-pipelines')).toBeNull(); }); @@ -312,7 +336,7 @@ describe('Pipelines', () => { }); describe('When API returns error', () => { - beforeEach((done) => { + beforeEach(done => { mock.onGet('twitter/flight/pipelines.json').reply(500, {}); vm = mountComponent(PipelinesComponent, { @@ -338,7 +362,9 @@ describe('Pipelines', () => { }); it('renders error state', () => { - expect(vm.$el.querySelector('.empty-state').textContent.trim()).toContain('There was an error fetching the pipelines.'); + expect(vm.$el.querySelector('.empty-state').textContent.trim()).toContain( + 'There was an error fetching the pipelines.', + ); }); }); }); @@ -356,46 +382,44 @@ describe('Pipelines', () => { }); }); - it('should render table', (done) => { + it('should render table', done => { setTimeout(() => { expect(vm.$el.querySelector('.table-holder')).toBeDefined(); - expect( - vm.$el.querySelectorAll('.gl-responsive-table-row').length, - ).toEqual(pipelines.pipelines.length + 1); + expect(vm.$el.querySelectorAll('.gl-responsive-table-row').length).toEqual( + pipelines.pipelines.length + 1, + ); done(); }); }); - it('should render navigation tabs', (done) => { + it('should render navigation tabs', done => { setTimeout(() => { - expect( - vm.$el.querySelector('.js-pipelines-tab-pending').textContent.trim(), - ).toContain('Pending'); + 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-all').textContent.trim()).toContain('All'); - expect( - vm.$el.querySelector('.js-pipelines-tab-running').textContent.trim(), - ).toContain('Running'); + 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-finished').textContent.trim()).toContain( + 'Finished', + ); - expect( - vm.$el.querySelector('.js-pipelines-tab-branches').textContent.trim(), - ).toContain('Branches'); + expect(vm.$el.querySelector('.js-pipelines-tab-branches').textContent.trim()).toContain( + 'Branches', + ); - expect( - vm.$el.querySelector('.js-pipelines-tab-tags').textContent.trim(), - ).toContain('Tags'); + expect(vm.$el.querySelector('.js-pipelines-tab-tags').textContent.trim()).toContain( + 'Tags', + ); done(); }); }); - it('should make an API request when using tabs', (done) => { + it('should make an API request when using tabs', done => { setTimeout(() => { spyOn(vm, 'updateContent'); vm.$el.querySelector('.js-pipelines-tab-finished').click(); @@ -406,7 +430,7 @@ describe('Pipelines', () => { }); describe('with pagination', () => { - it('should make an API request when using pagination', (done) => { + it('should make an API request when using pagination', done => { setTimeout(() => { spyOn(vm, 'updateContent'); // Mock pagination @@ -510,7 +534,7 @@ describe('Pipelines', () => { }); describe('emptyTabMessage', () => { - it('returns message with scope', (done) => { + it('returns message with scope', done => { vm.scope = 'pending'; vm.$nextTick(() => { @@ -529,7 +553,7 @@ describe('Pipelines', () => { expect(vm.stateToRender).toEqual('loading'); }); - it('returns error state when app has error', (done) => { + it('returns error state when app has error', done => { vm.hasError = true; vm.isLoading = false; @@ -539,7 +563,7 @@ describe('Pipelines', () => { }); }); - it('returns table list when app has pipelines', (done) => { + it('returns table list when app has pipelines', done => { vm.isLoading = false; vm.hasError = false; vm.state.pipelines = pipelines.pipelines; @@ -551,7 +575,7 @@ describe('Pipelines', () => { }); }); - it('returns empty tab when app does not have pipelines but project has pipelines', (done) => { + it('returns empty tab when app does not have pipelines but project has pipelines', done => { vm.state.count.all = 10; vm.isLoading = false; @@ -562,7 +586,7 @@ describe('Pipelines', () => { }); }); - it('returns empty tab when project has CI', (done) => { + it('returns empty tab when project has CI', done => { vm.isLoading = false; vm.$nextTick(() => { expect(vm.stateToRender).toEqual('emptyTab'); @@ -571,7 +595,7 @@ describe('Pipelines', () => { }); }); - it('returns empty state when project does not have pipelines nor CI', (done) => { + it('returns empty state when project does not have pipelines nor CI', done => { vm.isLoading = false; vm.hasGitlabCi = false; vm.$nextTick(() => { @@ -583,7 +607,7 @@ describe('Pipelines', () => { }); describe('shouldRenderTabs', () => { - it('returns true when state is loading & has already made the first request', (done) => { + it('returns true when state is loading & has already made the first request', done => { vm.isLoading = true; vm.hasMadeRequest = true; @@ -594,7 +618,7 @@ describe('Pipelines', () => { }); }); - it('returns true when state is tableList & has already made the first request', (done) => { + it('returns true when state is tableList & has already made the first request', done => { vm.isLoading = false; vm.state.pipelines = pipelines.pipelines; vm.hasMadeRequest = true; @@ -606,7 +630,7 @@ describe('Pipelines', () => { }); }); - it('returns true when state is error & has already made the first request', (done) => { + it('returns true when state is error & has already made the first request', done => { vm.isLoading = false; vm.hasError = true; vm.hasMadeRequest = true; @@ -618,7 +642,7 @@ describe('Pipelines', () => { }); }); - it('returns true when state is empty tab & has already made the first request', (done) => { + it('returns true when state is empty tab & has already made the first request', done => { vm.isLoading = false; vm.state.count.all = 10; vm.hasMadeRequest = true; @@ -630,7 +654,7 @@ describe('Pipelines', () => { }); }); - it('returns false when has not made first request', (done) => { + it('returns false when has not made first request', done => { vm.hasMadeRequest = false; vm.$nextTick(() => { @@ -640,7 +664,7 @@ describe('Pipelines', () => { }); }); - it('returns false when state is emtpy state', (done) => { + it('returns false when state is emtpy state', done => { vm.isLoading = false; vm.hasMadeRequest = true; vm.hasGitlabCi = false; @@ -654,7 +678,7 @@ describe('Pipelines', () => { }); describe('shouldRenderButtons', () => { - it('returns true when it has paths & has made the first request', (done) => { + it('returns true when it has paths & has made the first request', done => { vm.hasMadeRequest = true; vm.$nextTick(() => { @@ -664,7 +688,7 @@ describe('Pipelines', () => { }); }); - it('returns false when it has not made the first request', (done) => { + it('returns false when it has not made the first request', done => { vm.hasMadeRequest = false; vm.$nextTick(() => { @@ -681,19 +705,24 @@ describe('Pipelines', () => { const copyPipeline = Object.assign({}, pipelineWithStages); copyPipeline.id += 1; mock - .onGet('twitter/flight/pipelines.json').reply(200, { - pipelines: [pipelineWithStages], - count: { - all: 1, - finished: 1, - pending: 0, - running: 0, + .onGet('twitter/flight/pipelines.json') + .reply( + 200, + { + pipelines: [pipelineWithStages], + count: { + all: 1, + finished: 1, + pending: 0, + running: 0, + }, }, - }, { - 'POLL-INTERVAL': 100, - }) + { + 'POLL-INTERVAL': 100, + }, + ) .onGet(pipelineWithStages.details.stages[0].dropdown_path) - .reply(200, stageReply); + .reply(200, stageReply); vm = mountComponent(PipelinesComponent, { store: new Store(), @@ -704,7 +733,7 @@ describe('Pipelines', () => { }); describe('when a request is being made', () => { - it('stops polling, cancels the request, fetches pipelines & restarts polling', (done) => { + it('stops polling, cancels the request, fetches pipelines & restarts polling', done => { spyOn(vm.poll, 'stop'); spyOn(vm.poll, 'restart'); spyOn(vm, 'getPipelines').and.returnValue(Promise.resolve()); @@ -712,7 +741,8 @@ describe('Pipelines', () => { setTimeout(() => { vm.isMakingRequest = true; - return vm.$nextTick() + return vm + .$nextTick() .then(() => { vm.$el.querySelector('.js-builds-dropdown-button').click(); }) @@ -725,13 +755,14 @@ describe('Pipelines', () => { expect(vm.poll.restart).toHaveBeenCalled(); done(); }, 0); - }).catch(done.fail); + }) + .catch(done.fail); }, 0); }); }); describe('when no request is being made', () => { - it('stops polling, fetches pipelines & restarts polling', (done) => { + it('stops polling, fetches pipelines & restarts polling', done => { spyOn(vm.poll, 'stop'); spyOn(vm.poll, 'restart'); spyOn(vm, 'getPipelines').and.returnValue(Promise.resolve()); diff --git a/spec/javascripts/pipelines/pipelines_table_row_spec.js b/spec/javascripts/pipelines/pipelines_table_row_spec.js index fbd87506326..506d01f5ec1 100644 --- a/spec/javascripts/pipelines/pipelines_table_row_spec.js +++ b/spec/javascripts/pipelines/pipelines_table_row_spec.js @@ -204,7 +204,8 @@ describe('Pipelines Table Row', () => { it('renders a loading icon when `cancelingPipeline` matches pipeline id', done => { component.cancelingPipeline = pipeline.id; - component.$nextTick() + component + .$nextTick() .then(() => { expect(component.isCancelling).toEqual(true); }) diff --git a/spec/javascripts/pipelines/pipelines_table_spec.js b/spec/javascripts/pipelines/pipelines_table_spec.js index e0582acb954..63eb2d5f236 100644 --- a/spec/javascripts/pipelines/pipelines_table_spec.js +++ b/spec/javascripts/pipelines/pipelines_table_spec.js @@ -38,10 +38,18 @@ describe('Pipelines Table', () => { }); it('should render table head with correct columns', () => { - expect(component.$el.querySelector('.table-section.js-pipeline-status').textContent.trim()).toEqual('Status'); - expect(component.$el.querySelector('.table-section.js-pipeline-info').textContent.trim()).toEqual('Pipeline'); - expect(component.$el.querySelector('.table-section.js-pipeline-commit').textContent.trim()).toEqual('Commit'); - expect(component.$el.querySelector('.table-section.js-pipeline-stages').textContent.trim()).toEqual('Stages'); + expect( + component.$el.querySelector('.table-section.js-pipeline-status').textContent.trim(), + ).toEqual('Status'); + expect( + component.$el.querySelector('.table-section.js-pipeline-info').textContent.trim(), + ).toEqual('Pipeline'); + expect( + component.$el.querySelector('.table-section.js-pipeline-commit').textContent.trim(), + ).toEqual('Commit'); + expect( + component.$el.querySelector('.table-section.js-pipeline-stages').textContent.trim(), + ).toEqual('Stages'); }); }); diff --git a/spec/javascripts/pipelines/stage_spec.js b/spec/javascripts/pipelines/stage_spec.js index 7f28f310b43..a3caaeb44dc 100644 --- a/spec/javascripts/pipelines/stage_spec.js +++ b/spec/javascripts/pipelines/stage_spec.js @@ -120,12 +120,13 @@ 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); + component + .$nextTick() + .then(() => { + expect(eventHub.$emit).toHaveBeenCalledWith('refreshPipelinesTable'); + }) + .then(done) + .catch(done.fail); }, 0); }); }); -- cgit v1.2.3