Add test for deleting a status

This commit is contained in:
Angelina Filippova 2019-05-30 02:37:43 +02:00
parent 5a39c9cec0
commit c436b36a72
2 changed files with 16 additions and 2 deletions

View file

@ -4,8 +4,8 @@ const reports = [
{ created_at: '2019-05-18T13:01:33.000Z', account: { acct: 'nick', display_name: 'Nick Keys' }, actor: { acct: 'admin' }, state: 'closed', id: '3', content: '', statuses: [] },
{ created_at: '2019-05-21T21:35:33.000Z', account: { acct: 'benj', display_name: 'Benjamin Fame' }, actor: { acct: 'admin' }, state: 'open', id: '5', content: 'This is a report', statuses: [] },
{ created_at: '2019-05-20T22:45:33.000Z', account: { acct: 'alice', display_name: 'Alice Pool' }, actor: { acct: 'admin2' }, state: 'resolved', id: '7', content: 'Please block this user', statuses: [
{ account: { display_name: 'Alice Pool', avatar: '' }, visibility: 'public', sensitive: false, id: 11, content: 'Hey!', url: '', created_at: '2019-05-10T21:35:33.000Z' },
{ account: { display_name: 'Alice Pool', avatar: '' }, visibility: 'unlisted', sensitive: true, id: 10, content: 'Bye!', url: '', created_at: '2019-05-10T21:00:33.000Z' }
{ account: { display_name: 'Alice Pool', avatar: '' }, visibility: 'public', sensitive: false, id: '11', content: 'Hey!', url: '', created_at: '2019-05-10T21:35:33.000Z' },
{ account: { display_name: 'Alice Pool', avatar: '' }, visibility: 'unlisted', sensitive: true, id: '10', content: 'Bye!', url: '', created_at: '2019-05-10T21:00:33.000Z' }
] },
{ created_at: '2019-05-18T13:01:33.000Z', account: { acct: 'nick', display_name: 'Nick Keys' }, actor: { acct: 'admin' }, state: 'closed', id: '6', content: '', statuses: [] },
{ created_at: '2019-05-18T13:01:33.000Z', account: { acct: 'nick', display_name: 'Nick Keys' }, actor: { acct: 'admin' }, state: 'closed', id: '4', content: '', statuses: [] }
@ -31,3 +31,7 @@ export async function changeStatusScope(id, sensitive, visibility, authHost, tok
const status = reports[4].statuses[0]
return Promise.resolve({ data: { ...status, sensitive, visibility }})
}
export async function deleteStatus(statusId, authHost, token) {
return Promise.resolve()
}

View file

@ -144,4 +144,14 @@ describe('Report in a timeline', () => {
expect(store.state.reports.fetchedReports[4].statuses[1].visibility).toEqual('private')
done()
})
it('deletes a status', async (done) => {
const report = store.state.reports.fetchedReports[4]
expect(report.statuses.length).toEqual(2)
store.dispatch('DeleteStatus', { statusId: '11', reportId: '7'})
await flushPromises()
expect(store.state.reports.fetchedReports[4].statuses.length).toEqual(1)
done()
})
})