Commit 2955e956 authored by Winnie Hellmann's avatar Winnie Hellmann Committed by Phil Hughes

Clean up Vue warnings in tests

parent 50d4050d
...@@ -14,6 +14,7 @@ describe('Deploy keys key', () => { ...@@ -14,6 +14,7 @@ describe('Deploy keys key', () => {
propsData: { propsData: {
deployKey, deployKey,
store, store,
endpoint: 'https://test.host/dummy/endpoint',
}, },
}).$mount(); }).$mount();
}; };
......
...@@ -17,6 +17,7 @@ describe('Deploy keys panel', () => { ...@@ -17,6 +17,7 @@ describe('Deploy keys panel', () => {
keys: data.enabled_keys, keys: data.enabled_keys,
showHelpBox: true, showHelpBox: true,
store, store,
endpoint: 'https://test.host/dummy/endpoint',
}, },
}).$mount(); }).$mount();
......
...@@ -4,6 +4,10 @@ import '~/filtered_search/filtered_search_tokenizer'; ...@@ -4,6 +4,10 @@ import '~/filtered_search/filtered_search_tokenizer';
import '~/filtered_search/filtered_search_dropdown_manager'; import '~/filtered_search/filtered_search_dropdown_manager';
describe('Filtered Search Dropdown Manager', () => { describe('Filtered Search Dropdown Manager', () => {
beforeEach(() => {
spyOn(jQuery, 'ajax');
});
describe('addWordToInput', () => { describe('addWordToInput', () => {
function getInputValue() { function getInputValue() {
return document.querySelector('.filtered-search').value; return document.querySelector('.filtered-search').value;
......
import * as recentSearchesStoreSrc from '~/filtered_search/stores/recent_searches_store'; import * as recentSearchesStoreSrc from '~/filtered_search/stores/recent_searches_store';
import RecentSearchesService from '~/filtered_search/services/recent_searches_service'; import RecentSearchesService from '~/filtered_search/services/recent_searches_service';
import RecentSearchesServiceError from '~/filtered_search/services/recent_searches_service_error'; import RecentSearchesServiceError from '~/filtered_search/services/recent_searches_service_error';
import RecentSearchesRoot from '~/filtered_search/recent_searches_root';
import '~/lib/utils/url_utility'; import '~/lib/utils/url_utility';
import '~/lib/utils/common_utils'; import '~/lib/utils/common_utils';
import '~/filtered_search/filtered_search_token_keys'; import '~/filtered_search/filtered_search_token_keys';
...@@ -71,6 +72,7 @@ describe('Filtered Search Manager', () => { ...@@ -71,6 +72,7 @@ describe('Filtered Search Manager', () => {
beforeEach(() => { beforeEach(() => {
spyOn(RecentSearchesService, 'isAvailable').and.returnValue(isLocalStorageAvailable); spyOn(RecentSearchesService, 'isAvailable').and.returnValue(isLocalStorageAvailable);
spyOn(recentSearchesStoreSrc, 'default'); spyOn(recentSearchesStoreSrc, 'default');
spyOn(RecentSearchesRoot.prototype, 'render');
filteredSearchManager = new gl.FilteredSearchManager(); filteredSearchManager = new gl.FilteredSearchManager();
filteredSearchManager.setup(); filteredSearchManager.setup();
......
...@@ -51,7 +51,6 @@ describe('Issuable output', () => { ...@@ -51,7 +51,6 @@ describe('Issuable output', () => {
}); });
afterEach(() => { afterEach(() => {
Vue.http.interceptors = _.without(Vue.http.interceptors, issueShowInterceptor);
}); });
it('should render a title/description/edited and update title/description/edited on update', (done) => { it('should render a title/description/edited and update title/description/edited on update', (done) => {
......
/* eslint-disable jasmine/no-global-setup */
import $ from 'jquery'; import $ from 'jquery';
import _ from 'underscore'; import _ from 'underscore';
import 'jasmine-jquery'; import 'jasmine-jquery';
import '~/commons'; import '~/commons';
import Vue from 'vue';
import VueResource from 'vue-resource';
Vue.use(VueResource);
// enable test fixtures // enable test fixtures
jasmine.getFixtures().fixturesPath = '/base/spec/javascripts/fixtures'; jasmine.getFixtures().fixturesPath = '/base/spec/javascripts/fixtures';
jasmine.getJSONFixtures().fixturesPath = '/base/spec/javascripts/fixtures'; jasmine.getJSONFixtures().fixturesPath = '/base/spec/javascripts/fixtures';
...@@ -22,7 +28,25 @@ window.gon = window.gon || {}; ...@@ -22,7 +28,25 @@ window.gon = window.gon || {};
// enough for the socket to continue to communicate. // enough for the socket to continue to communicate.
// The downside is that it creates a minor performance penalty in the time it takes // The downside is that it creates a minor performance penalty in the time it takes
// to run our unit tests. // to run our unit tests.
beforeEach(done => done()); // eslint-disable-line jasmine/no-global-setup beforeEach(done => done());
beforeAll(() => {
const origError = console.error;
spyOn(console, 'error').and.callFake((message) => {
if (/^\[Vue warn\]/.test(message)) {
fail(message);
} else {
origError(message);
}
});
});
const builtinVueHttpInterceptors = Vue.http.interceptors.slice();
beforeEach(() => {
// restore interceptors so we have no remaining ones from previous tests
Vue.http.interceptors = builtinVueHttpInterceptors.slice();
});
// render all of our tests // render all of our tests
const testsContext = require.context('.', true, /_spec$/); const testsContext = require.context('.', true, /_spec$/);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment