From fdb12d7a05a9b8f513b6d0111b99d9cee461f1c6 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Thu, 30 May 2019 02:11:23 +0200 Subject: [PATCH] Add tests for adding and removing sensitive flag to a status --- src/api/__mocks__/reports.js | 10 ++++- src/views/reports/components/Statuses.vue | 2 +- test/views/reports/timelineItem.test.js | 54 ++++++++++++++++++++++- 3 files changed, 62 insertions(+), 4 deletions(-) diff --git a/src/api/__mocks__/reports.js b/src/api/__mocks__/reports.js index bdcf8df9..ccb83064 100644 --- a/src/api/__mocks__/reports.js +++ b/src/api/__mocks__/reports.js @@ -3,7 +3,10 @@ const reports = [ { created_at: '2019-05-20T22:45:33.000Z', account: { acct: 'alice', display_name: 'Alice Pool' }, actor: { acct: 'admin2' }, state: 'resolved', id: '1', content: 'Please block this user', statuses: [] }, { 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: [] }, + { 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' } + ] }, { 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: [] } ] @@ -23,3 +26,8 @@ export async function changeState(state, id, authHost, token) { const report = reports.find(report => report.id === id) return Promise.resolve({ data: { ...report, state }}) } + +export async function changeStatusScope(id, sensitive, visibility, authHost, token) { + const status = reports[4].statuses[0] + return Promise.resolve({ data: { ...status, sensitive, visibility }}) +} diff --git a/src/views/reports/components/Statuses.vue b/src/views/reports/components/Statuses.vue index 7834615e..3fefdfe7 100644 --- a/src/views/reports/components/Statuses.vue +++ b/src/views/reports/components/Statuses.vue @@ -61,7 +61,7 @@