diff options
Diffstat (limited to 'spec/javascripts/pipelines/stage_spec.js')
-rw-r--r-- | spec/javascripts/pipelines/stage_spec.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/spec/javascripts/pipelines/stage_spec.js b/spec/javascripts/pipelines/stage_spec.js index be1632e7206..75156e7bdfd 100644 --- a/spec/javascripts/pipelines/stage_spec.js +++ b/spec/javascripts/pipelines/stage_spec.js @@ -4,6 +4,7 @@ import axios from '~/lib/utils/axios_utils'; import stage from '~/pipelines/components/stage.vue'; import eventHub from '~/pipelines/event_hub'; import mountComponent from 'spec/helpers/vue_mount_component_helper'; +import { stageReply } from './mock_data'; describe('Pipelines stage component', () => { let StageComponent; @@ -41,7 +42,7 @@ describe('Pipelines stage component', () => { describe('with successfull request', () => { beforeEach(() => { - mock.onGet('path.json').reply(200, { html: 'foo' }); + mock.onGet('path.json').reply(200, stageReply); }); it('should render the received data and emit `clickedDropdown` event', done => { @@ -51,7 +52,7 @@ describe('Pipelines stage component', () => { setTimeout(() => { expect( component.$el.querySelector('.js-builds-dropdown-container ul').textContent.trim(), - ).toEqual('foo'); + ).toContain(stageReply.latest_statuses[0].name); expect(eventHub.$emit).toHaveBeenCalledWith('clickedDropdown'); done(); }, 0); @@ -74,7 +75,9 @@ describe('Pipelines stage component', () => { describe('update endpoint correctly', () => { beforeEach(() => { - mock.onGet('bar.json').reply(200, { html: 'this is the updated content' }); + const copyStage = Object.assign({}, stageReply); + copyStage.latest_statuses[0].name = 'this is the updated content'; + mock.onGet('bar.json').reply(200, copyStage); }); it('should update the stage to request the new endpoint provided', done => { @@ -93,7 +96,7 @@ describe('Pipelines stage component', () => { setTimeout(() => { expect( component.$el.querySelector('.js-builds-dropdown-container ul').textContent.trim(), - ).toEqual('this is the updated content'); + ).toContain('this is the updated content'); done(); }); }); |