Fix tests by mocking mrfPolicies field in users state

This commit is contained in:
Angelina Filippova 2020-08-29 00:43:57 +03:00
parent bf5f6beb75
commit 2e397f8790
6 changed files with 20 additions and 7 deletions

View file

@ -1,6 +1,7 @@
import app from '@/store/modules/app'
import peers from '@/store/modules/peers'
import user from '@/store/modules/user'
import users from '@/store/modules/users'
import settings from '@/store/modules/settings'
import status from '@/store/modules/status'
import getters from '@/store/getters'
@ -11,7 +12,8 @@ export default {
peers,
settings,
status,
user: { ...user, state: { ...user.state, authHost: 'localhost:4000' }}
user: { ...user, state: { ...user.state, authHost: 'localhost:4000' }},
users
},
getters
}

View file

@ -4,7 +4,7 @@ import flushPromises from 'flush-promises'
import Element from 'element-ui'
import Users from '@/views/users/index'
import NewAccountDialog from '@/views/users/components/NewAccountDialog'
import storeConfig from './store.conf'
import { storeConfig } from './store.conf'
import { cloneDeep } from 'lodash'
config.mocks["$t"] = () => {}

View file

@ -2,7 +2,7 @@ import Vuex from 'vuex'
import { mount, createLocalVue, config } from '@vue/test-utils'
import Element from 'element-ui'
import MultipleUsersMenu from '@/views/users/components/MultipleUsersMenu'
import storeConfig from './store.conf'
import { storeWithTagPolicy } from './store.conf'
import { cloneDeep } from 'lodash'
import flushPromises from 'flush-promises'
import { users } from '@/api/__mocks__/users.js'
@ -20,7 +20,7 @@ describe('Apply users actions to multiple users', () => {
let store
beforeEach(async() => {
store = new Vuex.Store(cloneDeep(storeConfig))
store = new Vuex.Store(cloneDeep(storeWithTagPolicy))
store.dispatch('FetchUsers', { page: 1 })
await flushPromises()
})

View file

@ -3,7 +3,7 @@ import { mount, createLocalVue, config } from '@vue/test-utils'
import flushPromises from 'flush-promises'
import Element from 'element-ui'
import UsersShow from '@/views/users/show'
import storeConfig from './store.conf'
import { storeConfig } from './store.conf'
import { cloneDeep } from 'lodash'
config.mocks["$t"] = () => {}

View file

@ -5,7 +5,7 @@ import userProfile from '@/store/modules/userProfile'
import users from '@/store/modules/users'
import getters from '@/store/getters'
export default {
export const storeConfig = {
modules: {
app,
settings,
@ -15,3 +15,14 @@ export default {
},
getters
}
export const storeWithTagPolicy = {
modules: {
app,
settings,
user,
userProfile,
users: { ...users, state: { ...users.state, tagPolicies: ['Pleroma.Web.ActivityPub.MRF.TagPolicy'] }}
},
getters
}

View file

@ -2,7 +2,7 @@ import Vuex from 'vuex'
import { mount, createLocalVue, config } from '@vue/test-utils'
import Element from 'element-ui'
import Filters from '@/views/users/components/UsersFilter'
import storeConfig from './store.conf'
import { storeConfig } from './store.conf'
import { cloneDeep } from 'lodash'
import flushPromises from 'flush-promises'