summaryrefslogtreecommitdiff
path: root/spec/javascripts/deploy_keys
diff options
context:
space:
mode:
authorPaul Slaughter <pslaughter@gitlab.com>2018-05-09 17:57:01 +0000
committerClement Ho <clemmakesapps@gmail.com>2018-05-09 17:57:01 +0000
commit0cc349f083b1436033608f4bec42dcd8d6c0d605 (patch)
tree13d211ac078e8125f10d8fde79213f1ba9db7380 /spec/javascripts/deploy_keys
parentf0a0da69d637c7d88a006ae02e570ec1c278349b (diff)
downloadgitlab-ce-0cc349f083b1436033608f4bec42dcd8d6c0d605.tar.gz
refactor "deploy_keys" to use axios
Diffstat (limited to 'spec/javascripts/deploy_keys')
-rw-r--r--spec/javascripts/deploy_keys/components/app_spec.js23
1 files changed, 10 insertions, 13 deletions
diff --git a/spec/javascripts/deploy_keys/components/app_spec.js b/spec/javascripts/deploy_keys/components/app_spec.js
index 3f9e25a8862..183d7cf2d41 100644
--- a/spec/javascripts/deploy_keys/components/app_spec.js
+++ b/spec/javascripts/deploy_keys/components/app_spec.js
@@ -1,28 +1,25 @@
-import _ from 'underscore';
import Vue from 'vue';
+import MockAdapter from 'axios-mock-adapter';
+import axios from '~/lib/utils/axios_utils';
import eventHub from '~/deploy_keys/eventhub';
import deployKeysApp from '~/deploy_keys/components/app.vue';
+import { TEST_HOST } from 'spec/test_constants';
describe('Deploy keys app component', () => {
const data = getJSONFixture('deploy_keys/keys.json');
let vm;
+ let mock;
- const deployKeysResponse = (request, next) => {
- next(
- request.respondWith(JSON.stringify(data), {
- status: 200,
- }),
- );
- };
+ beforeEach((done) => {
+ // setup axios mock before component
+ mock = new MockAdapter(axios);
+ mock.onGet(`${TEST_HOST}/dummy/`).replyOnce(200, data);
- beforeEach(done => {
const Component = Vue.extend(deployKeysApp);
- Vue.http.interceptors.push(deployKeysResponse);
-
vm = new Component({
propsData: {
- endpoint: '/test',
+ endpoint: `${TEST_HOST}/dummy`,
projectId: '8',
},
}).$mount();
@@ -31,7 +28,7 @@ describe('Deploy keys app component', () => {
});
afterEach(() => {
- Vue.http.interceptors = _.without(Vue.http.interceptors, deployKeysResponse);
+ mock.restore();
});
it('renders loading icon', done => {