diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2018-01-26 09:42:29 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2018-01-26 09:42:29 +0000 |
commit | ab6f4ad4c738df5387dd01302622cc67f78952d7 (patch) | |
tree | 96b9664a5f36fbd66cb88c30f9697e8a87f4ca2a /spec/javascripts | |
parent | b8d044af88507b300d98d9141a2a3d7735f0696d (diff) | |
parent | d82e709fe505d25ac414407dc17ac7e3d4692d76 (diff) | |
download | gitlab-ce-ab6f4ad4c738df5387dd01302622cc67f78952d7.tar.gz |
Merge branch 'winh-check-axios-restore' into 'master'
Make sure that axios adapater is restored after mocking
See merge request gitlab-org/gitlab-ce!16660
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/test_bundle.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/javascripts/test_bundle.js b/spec/javascripts/test_bundle.js index 2f6691df9cd..9b2a5379855 100644 --- a/spec/javascripts/test_bundle.js +++ b/spec/javascripts/test_bundle.js @@ -6,6 +6,8 @@ import '~/commons'; import Vue from 'vue'; import VueResource from 'vue-resource'; +import { getDefaultAdapter } from '~/lib/utils/axios_utils'; + const isHeadlessChrome = /\bHeadlessChrome\//.test(navigator.userAgent); Vue.config.devtools = !isHeadlessChrome; Vue.config.productionTip = false; @@ -59,6 +61,8 @@ beforeEach(() => { Vue.http.interceptors = builtinVueHttpInterceptors.slice(); }); +const axiosDefaultAdapter = getDefaultAdapter(); + // render all of our tests const testsContext = require.context('.', true, /_spec$/); testsContext.keys().forEach(function (path) { @@ -94,6 +98,12 @@ describe('test errors', () => { it('has no Vue error', () => { expect(hasVueErrors).toBe(false); }); + + it('restores axios adapter after mocking', () => { + if (getDefaultAdapter() !== axiosDefaultAdapter) { + fail('axios adapter is not restored! Did you forget a restore() on MockAdapter?'); + } + }); }); // if we're generating coverage reports, make sure to include all files so |