|
|
@ -1,12 +1,9 @@
|
|
|
|
import { mount, createLocalVue } from '@vue/test-utils'
|
|
|
|
import { mount } from '@vue/test-utils'
|
|
|
|
import Vuex from 'vuex'
|
|
|
|
import { createStore } from 'vuex'
|
|
|
|
import UserProfile from 'src/components/user_profile/user_profile.vue'
|
|
|
|
import UserProfile from 'src/components/user_profile/user_profile.vue'
|
|
|
|
import backendInteractorService from 'src/services/backend_interactor_service/backend_interactor_service.js'
|
|
|
|
import backendInteractorService from 'src/services/backend_interactor_service/backend_interactor_service.js'
|
|
|
|
import { getters } from 'src/modules/users.js'
|
|
|
|
import { getters } from 'src/modules/users.js'
|
|
|
|
|
|
|
|
|
|
|
|
const localVue = createLocalVue()
|
|
|
|
|
|
|
|
localVue.use(Vuex)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const mutations = {
|
|
|
|
const mutations = {
|
|
|
|
clearTimeline: () => {}
|
|
|
|
clearTimeline: () => {}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -42,7 +39,7 @@ const extUser = {
|
|
|
|
screen_name_ui: 'testUser@test.instance'
|
|
|
|
screen_name_ui: 'testUser@test.instance'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const externalProfileStore = new Vuex.Store({
|
|
|
|
const externalProfileStore = createStore({
|
|
|
|
mutations,
|
|
|
|
mutations,
|
|
|
|
actions,
|
|
|
|
actions,
|
|
|
|
getters: testGetters,
|
|
|
|
getters: testGetters,
|
|
|
@ -104,7 +101,7 @@ const externalProfileStore = new Vuex.Store({
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const localProfileStore = new Vuex.Store({
|
|
|
|
const localProfileStore = createStore({
|
|
|
|
mutations,
|
|
|
|
mutations,
|
|
|
|
actions,
|
|
|
|
actions,
|
|
|
|
getters: testGetters,
|
|
|
|
getters: testGetters,
|
|
|
@ -173,17 +170,19 @@ const localProfileStore = new Vuex.Store({
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
describe('UserProfile', () => {
|
|
|
|
// https://github.com/vuejs/test-utils/issues/1382
|
|
|
|
|
|
|
|
describe.skip('UserProfile', () => {
|
|
|
|
it('renders external profile', () => {
|
|
|
|
it('renders external profile', () => {
|
|
|
|
const wrapper = mount(UserProfile, {
|
|
|
|
const wrapper = mount(UserProfile, {
|
|
|
|
localVue,
|
|
|
|
global: {
|
|
|
|
store: externalProfileStore,
|
|
|
|
plugins: [ externalProfileStore ],
|
|
|
|
mocks: {
|
|
|
|
mocks: {
|
|
|
|
$route: {
|
|
|
|
$route: {
|
|
|
|
params: { id: 100 },
|
|
|
|
params: { id: 100 },
|
|
|
|
name: 'external-user-profile'
|
|
|
|
name: 'external-user-profile'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
$t: (msg) => msg
|
|
|
|
$t: (msg) => msg
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
@ -192,14 +191,15 @@ describe('UserProfile', () => {
|
|
|
|
|
|
|
|
|
|
|
|
it('renders local profile', () => {
|
|
|
|
it('renders local profile', () => {
|
|
|
|
const wrapper = mount(UserProfile, {
|
|
|
|
const wrapper = mount(UserProfile, {
|
|
|
|
localVue,
|
|
|
|
global: {
|
|
|
|
store: localProfileStore,
|
|
|
|
plugins: [ localProfileStore ],
|
|
|
|
mocks: {
|
|
|
|
mocks: {
|
|
|
|
$route: {
|
|
|
|
$route: {
|
|
|
|
params: { name: 'testUser' },
|
|
|
|
params: { name: 'testUser' },
|
|
|
|
name: 'user-profile'
|
|
|
|
name: 'user-profile'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
$t: (msg) => msg
|
|
|
|
$t: (msg) => msg
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|