forked from AkkomaGang/admin-fe
Update test that fetches data on single status show page
This commit is contained in:
parent
2621d7cb51
commit
3ded23dfe7
2 changed files with 8 additions and 2 deletions
|
@ -6,7 +6,11 @@ export let users = [
|
||||||
|
|
||||||
const userProfile = { avatar: 'avatar.jpg', display_name: 'Allis', nickname: 'allis', id: '2', tags: [], roles: { admin: true, moderator: false }, local: true, external: false }
|
const userProfile = { avatar: 'avatar.jpg', display_name: 'Allis', nickname: 'allis', id: '2', tags: [], roles: { admin: true, moderator: false }, local: true, external: false }
|
||||||
|
|
||||||
const userStatuses = []
|
const userStatuses = [
|
||||||
|
{ account: { id: '9n1bySks25olxWrku0', display_name: 'dolin' }, content: 'pizza makes everything better', id: '9vJOO3iFPyjNaEhJ5s', created_at: '2020-05-22T17:34:34.000Z', visibility: 'public' },
|
||||||
|
{ account: { id: '9n1bySks25olxWrku0', display_name: 'dolin' }, content: 'pizza time', id: '9vJPD5XKOdzQ0bvGLY', created_at: '2020-05-22T17:34:34.000Z', visibility: 'public' },
|
||||||
|
{ account: { id: '9n1bySks25olxWrku0', display_name: 'dolin' }, content: 'what is yout favorite pizza?', id: '9jop82OBXeFPYulVjM', created_at: '2020-05-22T17:34:34.000Z', visibility: 'public' }
|
||||||
|
]
|
||||||
|
|
||||||
const filterUsers = (str) => {
|
const filterUsers = (str) => {
|
||||||
const filters = str.split(',').filter(item => item.length > 0)
|
const filters = str.split(',').filter(item => item.length > 0)
|
||||||
|
|
|
@ -22,6 +22,7 @@ jest.mock('@/api/app')
|
||||||
jest.mock('@/api/status')
|
jest.mock('@/api/status')
|
||||||
jest.mock('@/api/peers')
|
jest.mock('@/api/peers')
|
||||||
jest.mock('@/api/nodeInfo')
|
jest.mock('@/api/nodeInfo')
|
||||||
|
jest.mock('@/api/users')
|
||||||
|
|
||||||
describe('Status show page', () => {
|
describe('Status show page', () => {
|
||||||
let store
|
let store
|
||||||
|
@ -30,7 +31,7 @@ describe('Status show page', () => {
|
||||||
store = new Vuex.Store(cloneDeep(storeConfig))
|
store = new Vuex.Store(cloneDeep(storeConfig))
|
||||||
})
|
})
|
||||||
|
|
||||||
it('fetches status', async (done) => {
|
it(`fetches single status and user's statuses`, async (done) => {
|
||||||
const wrapper = mount(StatusShow, {
|
const wrapper = mount(StatusShow, {
|
||||||
store,
|
store,
|
||||||
localVue,
|
localVue,
|
||||||
|
@ -45,6 +46,7 @@ describe('Status show page', () => {
|
||||||
expect(wrapper.find('.status-container').isVisible()).toBe(true)
|
expect(wrapper.find('.status-container').isVisible()).toBe(true)
|
||||||
expect(store.state.status.fetchedStatus.id).toBe('9vJOO3iFPyjNaEhJ5s')
|
expect(store.state.status.fetchedStatus.id).toBe('9vJOO3iFPyjNaEhJ5s')
|
||||||
expect(store.state.status.fetchedStatus.account.display_name).toBe('dolin')
|
expect(store.state.status.fetchedStatus.account.display_name).toBe('dolin')
|
||||||
|
expect(store.state.userProfile.statuses.length).toEqual(3)
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue