From 3ded23dfe73f046a70e93fc8ff50aab0ae7fc61c Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Tue, 26 May 2020 22:38:03 +0300 Subject: [PATCH] Update test that fetches data on single status show page --- src/api/__mocks__/users.js | 6 +++++- test/views/statuses/show.test.js | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/api/__mocks__/users.js b/src/api/__mocks__/users.js index 9a3afd41..bdcf404a 100644 --- a/src/api/__mocks__/users.js +++ b/src/api/__mocks__/users.js @@ -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 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 filters = str.split(',').filter(item => item.length > 0) diff --git a/test/views/statuses/show.test.js b/test/views/statuses/show.test.js index 4aec7c69..f4a37a16 100644 --- a/test/views/statuses/show.test.js +++ b/test/views/statuses/show.test.js @@ -22,6 +22,7 @@ jest.mock('@/api/app') jest.mock('@/api/status') jest.mock('@/api/peers') jest.mock('@/api/nodeInfo') +jest.mock('@/api/users') describe('Status show page', () => { let store @@ -30,7 +31,7 @@ describe('Status show page', () => { 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, { store, localVue, @@ -45,6 +46,7 @@ describe('Status show page', () => { expect(wrapper.find('.status-container').isVisible()).toBe(true) expect(store.state.status.fetchedStatus.id).toBe('9vJOO3iFPyjNaEhJ5s') expect(store.state.status.fetchedStatus.account.display_name).toBe('dolin') + expect(store.state.userProfile.statuses.length).toEqual(3) done() }) })