forked from AkkomaGang/admin-fe
Fix tests by mocking mrfPolicies field in users state
This commit is contained in:
parent
bf5f6beb75
commit
2e397f8790
6 changed files with 20 additions and 7 deletions
|
@ -1,6 +1,7 @@
|
||||||
import app from '@/store/modules/app'
|
import app from '@/store/modules/app'
|
||||||
import peers from '@/store/modules/peers'
|
import peers from '@/store/modules/peers'
|
||||||
import user from '@/store/modules/user'
|
import user from '@/store/modules/user'
|
||||||
|
import users from '@/store/modules/users'
|
||||||
import settings from '@/store/modules/settings'
|
import settings from '@/store/modules/settings'
|
||||||
import status from '@/store/modules/status'
|
import status from '@/store/modules/status'
|
||||||
import getters from '@/store/getters'
|
import getters from '@/store/getters'
|
||||||
|
@ -11,7 +12,8 @@ export default {
|
||||||
peers,
|
peers,
|
||||||
settings,
|
settings,
|
||||||
status,
|
status,
|
||||||
user: { ...user, state: { ...user.state, authHost: 'localhost:4000' }}
|
user: { ...user, state: { ...user.state, authHost: 'localhost:4000' }},
|
||||||
|
users
|
||||||
},
|
},
|
||||||
getters
|
getters
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import flushPromises from 'flush-promises'
|
||||||
import Element from 'element-ui'
|
import Element from 'element-ui'
|
||||||
import Users from '@/views/users/index'
|
import Users from '@/views/users/index'
|
||||||
import NewAccountDialog from '@/views/users/components/NewAccountDialog'
|
import NewAccountDialog from '@/views/users/components/NewAccountDialog'
|
||||||
import storeConfig from './store.conf'
|
import { storeConfig } from './store.conf'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
|
|
||||||
config.mocks["$t"] = () => {}
|
config.mocks["$t"] = () => {}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import Vuex from 'vuex'
|
||||||
import { mount, createLocalVue, config } from '@vue/test-utils'
|
import { mount, createLocalVue, config } from '@vue/test-utils'
|
||||||
import Element from 'element-ui'
|
import Element from 'element-ui'
|
||||||
import MultipleUsersMenu from '@/views/users/components/MultipleUsersMenu'
|
import MultipleUsersMenu from '@/views/users/components/MultipleUsersMenu'
|
||||||
import storeConfig from './store.conf'
|
import { storeWithTagPolicy } from './store.conf'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
import flushPromises from 'flush-promises'
|
import flushPromises from 'flush-promises'
|
||||||
import { users } from '@/api/__mocks__/users.js'
|
import { users } from '@/api/__mocks__/users.js'
|
||||||
|
@ -20,7 +20,7 @@ describe('Apply users actions to multiple users', () => {
|
||||||
let store
|
let store
|
||||||
|
|
||||||
beforeEach(async() => {
|
beforeEach(async() => {
|
||||||
store = new Vuex.Store(cloneDeep(storeConfig))
|
store = new Vuex.Store(cloneDeep(storeWithTagPolicy))
|
||||||
store.dispatch('FetchUsers', { page: 1 })
|
store.dispatch('FetchUsers', { page: 1 })
|
||||||
await flushPromises()
|
await flushPromises()
|
||||||
})
|
})
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { mount, createLocalVue, config } from '@vue/test-utils'
|
||||||
import flushPromises from 'flush-promises'
|
import flushPromises from 'flush-promises'
|
||||||
import Element from 'element-ui'
|
import Element from 'element-ui'
|
||||||
import UsersShow from '@/views/users/show'
|
import UsersShow from '@/views/users/show'
|
||||||
import storeConfig from './store.conf'
|
import { storeConfig } from './store.conf'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
|
|
||||||
config.mocks["$t"] = () => {}
|
config.mocks["$t"] = () => {}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import userProfile from '@/store/modules/userProfile'
|
||||||
import users from '@/store/modules/users'
|
import users from '@/store/modules/users'
|
||||||
import getters from '@/store/getters'
|
import getters from '@/store/getters'
|
||||||
|
|
||||||
export default {
|
export const storeConfig = {
|
||||||
modules: {
|
modules: {
|
||||||
app,
|
app,
|
||||||
settings,
|
settings,
|
||||||
|
@ -15,3 +15,14 @@ export default {
|
||||||
},
|
},
|
||||||
getters
|
getters
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const storeWithTagPolicy = {
|
||||||
|
modules: {
|
||||||
|
app,
|
||||||
|
settings,
|
||||||
|
user,
|
||||||
|
userProfile,
|
||||||
|
users: { ...users, state: { ...users.state, tagPolicies: ['Pleroma.Web.ActivityPub.MRF.TagPolicy'] }}
|
||||||
|
},
|
||||||
|
getters
|
||||||
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import Vuex from 'vuex'
|
||||||
import { mount, createLocalVue, config } from '@vue/test-utils'
|
import { mount, createLocalVue, config } from '@vue/test-utils'
|
||||||
import Element from 'element-ui'
|
import Element from 'element-ui'
|
||||||
import Filters from '@/views/users/components/UsersFilter'
|
import Filters from '@/views/users/components/UsersFilter'
|
||||||
import storeConfig from './store.conf'
|
import { storeConfig } from './store.conf'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
import flushPromises from 'flush-promises'
|
import flushPromises from 'flush-promises'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue