diff --git a/test/views/invites/index.test.js b/test/views/invites/index.test.js index 2f78090d..1463764a 100644 --- a/test/views/invites/index.test.js +++ b/test/views/invites/index.test.js @@ -1,5 +1,5 @@ import Vuex from 'vuex' -import { mount, createLocalVue, config } from '@vue/test-utils' +import { mount, createLocalVue, config, RouterLinkStub } from '@vue/test-utils' import flushPromises from 'flush-promises' import Element from 'element-ui' import Invites from '@/views/invites/index' @@ -28,7 +28,9 @@ describe('Invite tokens', () => { store, localVue, sync: false, - stubs: ['router-link'] + stubs: { + RouterLink: RouterLinkStub + } }) await flushPromises() @@ -42,7 +44,9 @@ describe('Invite tokens', () => { store, localVue, sync: false, - stubs: ['router-link'] + stubs: { + RouterLink: RouterLinkStub + } }) await flushPromises() @@ -66,7 +70,9 @@ describe('Invite tokens', () => { store, localVue, sync: false, - stubs: ['router-link'] + stubs: { + RouterLink: RouterLinkStub + } }) await flushPromises() expect(store.state.invites.inviteTokens.length).toEqual(3) @@ -101,7 +107,9 @@ describe('Invite tokens', () => { store, localVue, sync: false, - stubs: ['router-link'] + stubs: { + RouterLink: RouterLinkStub + } }) await flushPromises() @@ -120,7 +128,9 @@ describe('Invite tokens', () => { store, localVue, sync: false, - stubs: ['router-link'] + stubs: { + RouterLink: RouterLinkStub + } }) const dialog = wrapper.find('div.el-dialog__wrapper .invite-via-email-dialog') diff --git a/test/views/reports/index.test.js b/test/views/reports/index.test.js index 1d8365ac..ee346c77 100644 --- a/test/views/reports/index.test.js +++ b/test/views/reports/index.test.js @@ -7,8 +7,8 @@ import { cloneDeep } from 'lodash' import flushPromises from 'flush-promises' config.mocks["$t"] = () => {} -config.stubs['reports-filter'] = '
' -config.stubs['timeline-item'] = '' +config.stubs['reports-filter'] = { template: ''} +config.stubs['timeline-item'] = { template: ''} const localVue = createLocalVue() localVue.use(Vuex) diff --git a/test/views/settings/index.test.js b/test/views/settings/index.test.js index 4cacf881..d0bdabc8 100644 --- a/test/views/settings/index.test.js +++ b/test/views/settings/index.test.js @@ -5,6 +5,7 @@ import Settings from '@/views/settings/index' import flushPromises from 'flush-promises' import app from '@/store/modules/app' import settings from '@/store/modules/settings' +import user from '@/store/modules/user' import getters from '@/store/getters' config.mocks["$t"] = () => {} @@ -24,7 +25,8 @@ describe('Settings search', () => { store = new Vuex.Store({ modules: { app: { ...app, actions: appActions }, - settings: { ...settings, actions } + settings: { ...settings, actions }, + user: { ...user, state: { ...user.state, authHost: 'localhost:4000' }} }, getters }) diff --git a/test/views/statuses/index.test.js b/test/views/statuses/index.test.js index 62921650..fdbc6b31 100644 --- a/test/views/statuses/index.test.js +++ b/test/views/statuses/index.test.js @@ -7,6 +7,7 @@ import storeConfig from './store.conf' import { cloneDeep } from 'lodash' config.mocks["$t"] = () => {} +config.stubs.transition = false const localVue = createLocalVue() localVue.use(Vuex) diff --git a/test/views/statuses/pagination.test.js b/test/views/statuses/pagination.test.js index 2cbfb823..8dc15b63 100644 --- a/test/views/statuses/pagination.test.js +++ b/test/views/statuses/pagination.test.js @@ -7,6 +7,7 @@ import storeConfig from './storeForPagination.conf' import { cloneDeep } from 'lodash' config.mocks["$t"] = () => {} +config.stubs.transition = false const localVue = createLocalVue() localVue.use(Vuex) diff --git a/test/views/statuses/show.test.js b/test/views/statuses/show.test.js index 66da0712..3c2a5124 100644 --- a/test/views/statuses/show.test.js +++ b/test/views/statuses/show.test.js @@ -1,5 +1,5 @@ import Vuex from 'vuex' -import { mount, createLocalVue, config } from '@vue/test-utils' +import { mount, createLocalVue, config, RouterLinkStub } from '@vue/test-utils' import flushPromises from 'flush-promises' import Element from 'element-ui' import StatusShow from '@/views/statuses/show' @@ -7,6 +7,7 @@ import storeConfig from './statusShowStore.conf' import { cloneDeep } from 'lodash' config.mocks["$t"] = () => {} +config.stubs.transition = false const localVue = createLocalVue() localVue.use(Vuex) @@ -36,7 +37,9 @@ describe('Status show page', () => { store, localVue, sync: false, - stubs: ['router-link'], + stubs: { + RouterLink: RouterLinkStub + }, mocks: { $route } @@ -55,14 +58,16 @@ describe('Status show page', () => { store, localVue, sync: false, - stubs: ['router-link'], + stubs: { + RouterLink: RouterLinkStub + }, mocks: { $route } }) await flushPromises() - expect(wrapper.find('router-link-stub h1').text()).toBe('dolin') + expect(wrapper.findComponent(RouterLinkStub).find('h1').text()).toBe('dolin') expect(wrapper.find('button.moderate-user-button').exists()).toBe(true) expect(wrapper.find('.el-dropdown-menu').exists()).toBe(true) done() @@ -73,7 +78,9 @@ describe('Status show page', () => { store, localVue, sync: false, - stubs: ['router-link'], + stubs: { + RouterLink: RouterLinkStub + }, mocks: { $route } @@ -81,7 +88,7 @@ describe('Status show page', () => { await flushPromises() expect(wrapper.find('.status-card').exists()).toBe(true) - expect(wrapper.find('router-link-stub span.status-account-name').text()).toBe('dolin') + expect(wrapper.findAllComponents(RouterLinkStub).at(1).find('span.status-account-name').text()).toBe('dolin') expect(wrapper.find('span.el-tag').text()).not.toBe('Sensitive') expect(wrapper.find('span.el-tag').text()).toBe('Public') expect(wrapper.find('button.status-actions-button').exists()).toBe(true) diff --git a/test/views/users/index.test.js b/test/views/users/index.test.js index ad77a9be..10c3e90d 100644 --- a/test/views/users/index.test.js +++ b/test/views/users/index.test.js @@ -1,5 +1,5 @@ import Vuex from 'vuex' -import { mount, createLocalVue, config } from '@vue/test-utils' +import { mount, createLocalVue, config, RouterLinkStub } from '@vue/test-utils' import flushPromises from 'flush-promises' import Element from 'element-ui' import Users from '@/views/users/index' @@ -8,7 +8,8 @@ import { storeConfig } from './store.conf' import { cloneDeep } from 'lodash' config.mocks["$t"] = () => {} -config.stubs['users-filter'] = '' +config.stubs['users-filter'] = { template: ''} +config.stubs.transition = false const localVue = createLocalVue() localVue.use(Vuex) @@ -31,7 +32,9 @@ describe('Search and filter users', () => { store, localVue, sync: false, - stubs: ['router-link'] + stubs: { + RouterLink: RouterLinkStub + } }) await flushPromises() @@ -44,7 +47,9 @@ describe('Search and filter users', () => { store, localVue, sync: false, - stubs: ['router-link'] + stubs: { + RouterLink: RouterLinkStub + } }) wrapper.vm.handleDebounceSearchInput = (query) => { @@ -82,7 +87,9 @@ describe('Users actions', () => { store, localVue, sync: false, - stubs: ['router-link'] + stubs: { + RouterLink: RouterLinkStub + } }) await flushPromises() @@ -101,7 +108,9 @@ describe('Users actions', () => { store, localVue, sync: false, - stubs: ['router-link'] + stubs: { + RouterLink: RouterLinkStub + } }) await flushPromises() @@ -120,7 +129,9 @@ describe('Users actions', () => { store, localVue, sync: false, - stubs: ['router-link'] + stubs: { + RouterLink: RouterLinkStub + } }) await flushPromises() @@ -136,7 +147,9 @@ describe('Users actions', () => { store, localVue, sync: false, - stubs: ['router-link'] + stubs: { + RouterLink: RouterLinkStub + } }) await flushPromises() @@ -154,7 +167,9 @@ describe('Users actions', () => { store, localVue, sync: false, - stubs: ['router-link'] + stubs: { + RouterLink: RouterLinkStub + } }) await flushPromises() expect(store.state.users.fetchedUsers[1].deactivated).toBe(false) @@ -172,7 +187,9 @@ describe('Users actions', () => { store, localVue, sync: false, - stubs: ['router-link'] + stubs: { + RouterLink: RouterLinkStub + } }) await flushPromises() @@ -196,7 +213,9 @@ describe('Users actions', () => { store, localVue, sync: false, - stubs: ['router-link'] + stubs: { + RouterLink: RouterLinkStub + } }) await flushPromises() @@ -214,7 +233,9 @@ describe('Users actions', () => { store, localVue, sync: false, - stubs: ['router-link'] + stubs: { + RouterLink: RouterLinkStub + } }) await flushPromises() @@ -239,7 +260,9 @@ describe('Users actions', () => { store, localVue, sync: false, - stubs: ['router-link'] + stubs: { + RouterLink: RouterLinkStub + } }) await flushPromises() @@ -278,7 +301,9 @@ describe('Creates new account', () => { store, localVue, sync: false, - stubs: ['router-link'] + stubs: { + RouterLink: RouterLinkStub + } }) await flushPromises() @@ -302,7 +327,9 @@ describe('Creates new account', () => { store, localVue, sync: false, - stubs: ['router-link'] + stubs: { + RouterLink: RouterLinkStub + } }) await flushPromises() expect(wrapper.vm.usersCount).toEqual(4) @@ -336,7 +363,9 @@ describe('Creates new account', () => { store, localVue, sync: false, - stubs: ['router-link'] + stubs: { + RouterLink: RouterLinkStub + } }) const validateEmailRule = { validator: wrapper.vm.validateEmail, field: 'email', fullField: 'email', type: 'string' } @@ -361,7 +390,9 @@ describe('Creates new account', () => { store, localVue, sync: false, - stubs: ['router-link'] + stubs: { + RouterLink: RouterLinkStub + } }) await flushPromises() diff --git a/test/views/users/show.test.js b/test/views/users/show.test.js index 4dc353e7..8ce9cca6 100644 --- a/test/views/users/show.test.js +++ b/test/views/users/show.test.js @@ -1,5 +1,5 @@ import Vuex from 'vuex' -import { mount, createLocalVue, config } from '@vue/test-utils' +import { mount, createLocalVue, config, RouterLinkStub } from '@vue/test-utils' import flushPromises from 'flush-promises' import Element from 'element-ui' import UsersShow from '@/views/users/show' @@ -7,6 +7,7 @@ import { storeConfig } from './store.conf' import { cloneDeep } from 'lodash' config.mocks["$t"] = () => {} +config.stubs.transition = false const localVue = createLocalVue() localVue.use(Vuex) @@ -33,7 +34,9 @@ describe('User profile', () => { store, localVue, sync: false, - stubs: ['router-link'], + stubs: { + RouterLink: RouterLinkStub + }, mocks: { $route }