Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Luís <aluis@gitlab.com>2018-05-22 20:18:58 +0300
committerAndré Luís <aluis@gitlab.com>2018-05-24 19:39:14 +0300
commit1bc72f668c4979d6f812f8b82b95ae9239c284ab (patch)
treecf9465c8375c912e882944e78f8e7e640e11f502
parent4909f638f35819a0342810e35642b7f941860591 (diff)
Use axios mock adapter in the pipelinePoll test
-rw-r--r--spec/javascripts/ide/stores/actions/project_spec.js21
1 files changed, 10 insertions, 11 deletions
diff --git a/spec/javascripts/ide/stores/actions/project_spec.js b/spec/javascripts/ide/stores/actions/project_spec.js
index 66f2ebdffc3..41fa2f01576 100644
--- a/spec/javascripts/ide/stores/actions/project_spec.js
+++ b/spec/javascripts/ide/stores/actions/project_spec.js
@@ -1,4 +1,5 @@
import Visibility from 'visibilityjs';
+import MockAdapter from 'axios-mock-adapter';
import { refreshLastCommitData, pollSuccessCallBack } from '~/ide/stores/actions';
import store from '~/ide/stores';
import service from '~/ide/services';
@@ -102,24 +103,22 @@ describe('IDE store project actions', () => {
});
describe('pipelinePoll', () => {
+ let mock;
+
beforeEach(() => {
setProjectState();
jasmine.clock().install();
- spyOn(axios, 'get').and.returnValue(
- Promise.resolve({
- status: 200,
- headers: {
- 'poll-interval': '10000',
- },
- data: {
- foo: 'bar',
- },
- }),
- );
+ mock = new MockAdapter(axios);
+ mock
+ .onGet('/abc/def/commit/abc123def456ghi789jkl/pipelines')
+ .reply(200, { data: { foo: 'bar' } }, { 'poll-interval': '10000' });
+
+ spyOn(axios, 'get').and.callThrough();
});
afterEach(() => {
jasmine.clock().uninstall();
+ mock.restore();
});
it('calls service with last fetched state', done => {