Clean up Vue warnings in tests

This commit is contained in:
Winnie Hellmann 2017-06-20 08:05:55 +00:00 committed by Phil Hughes
parent 50d4050d7e
commit 2955e95604
6 changed files with 33 additions and 2 deletions

View File

@ -14,6 +14,7 @@ describe('Deploy keys key', () => {
propsData: {
deployKey,
store,
endpoint: 'https://test.host/dummy/endpoint',
},
}).$mount();
};

View File

@ -17,6 +17,7 @@ describe('Deploy keys panel', () => {
keys: data.enabled_keys,
showHelpBox: true,
store,
endpoint: 'https://test.host/dummy/endpoint',
},
}).$mount();

View File

@ -4,6 +4,10 @@ import '~/filtered_search/filtered_search_tokenizer';
import '~/filtered_search/filtered_search_dropdown_manager';
describe('Filtered Search Dropdown Manager', () => {
beforeEach(() => {
spyOn(jQuery, 'ajax');
});
describe('addWordToInput', () => {
function getInputValue() {
return document.querySelector('.filtered-search').value;

View File

@ -1,6 +1,7 @@
import * as recentSearchesStoreSrc from '~/filtered_search/stores/recent_searches_store';
import RecentSearchesService from '~/filtered_search/services/recent_searches_service';
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/common_utils';
import '~/filtered_search/filtered_search_token_keys';
@ -71,6 +72,7 @@ describe('Filtered Search Manager', () => {
beforeEach(() => {
spyOn(RecentSearchesService, 'isAvailable').and.returnValue(isLocalStorageAvailable);
spyOn(recentSearchesStoreSrc, 'default');
spyOn(RecentSearchesRoot.prototype, 'render');
filteredSearchManager = new gl.FilteredSearchManager();
filteredSearchManager.setup();

View File

@ -51,7 +51,6 @@ describe('Issuable output', () => {
});
afterEach(() => {
Vue.http.interceptors = _.without(Vue.http.interceptors, issueShowInterceptor);
});
it('should render a title/description/edited and update title/description/edited on update', (done) => {

View File

@ -1,8 +1,14 @@
/* eslint-disable jasmine/no-global-setup */
import $ from 'jquery';
import _ from 'underscore';
import 'jasmine-jquery';
import '~/commons';
import Vue from 'vue';
import VueResource from 'vue-resource';
Vue.use(VueResource);
// enable test fixtures
jasmine.getFixtures().fixturesPath = '/base/spec/javascripts/fixtures';
jasmine.getJSONFixtures().fixturesPath = '/base/spec/javascripts/fixtures';
@ -22,7 +28,25 @@ window.gon = window.gon || {};
// enough for the socket to continue to communicate.
// The downside is that it creates a minor performance penalty in the time it takes
// 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
const testsContext = require.context('.', true, /_spec$/);