From e7b4d8745e7ba083b2998548a957491f17b953f7 Mon Sep 17 00:00:00 2001 From: Mihail Hagiu <mihail.hagiu@thinslices.com> Date: Mon, 22 Oct 2018 13:40:43 +0300 Subject: [PATCH] fix(ReviewersCanSeeEditorialComments): Added test for new case --- .../tests/config/authsome-helpers.test.js | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/xpub-faraday/tests/config/authsome-helpers.test.js b/packages/xpub-faraday/tests/config/authsome-helpers.test.js index cd0da4941..ced5b1e95 100644 --- a/packages/xpub-faraday/tests/config/authsome-helpers.test.js +++ b/packages/xpub-faraday/tests/config/authsome-helpers.test.js @@ -115,11 +115,27 @@ describe('Authsome Helpers', () => { const { files = {} } = result expect(files.coverLetter).toBeFalsy() }) - it('reviewer should not see others reviews', () => { + it('reviewer should not see private comments', () => { const { fragment } = testFixtures.fragments + fragment.recommendations = [ + { + comments: [ + { + content: 'private', + public: false, + }, + { + content: 'public', + public: true, + }, + ], + }, + ] const result = ah.stripeFragmentByRole({ fragment, role: 'reviewer' }) const { recommendations } = result - expect(recommendations).toHaveLength(2) + expect(recommendations).toHaveLength(1) + expect(recommendations[0].comments).toHaveLength(1) + expect(recommendations[0].comments[0].public).toEqual(true) }) it('author should not see recommendations if a decision has not been made', () => { @@ -170,6 +186,7 @@ describe('Authsome Helpers', () => { const publicComments = get(result, 'recommendations[0].comments') expect(publicComments).toHaveLength(1) }) + it('HE should not see unsubmitted recommendations', () => { const { fragment } = testFixtures.fragments fragment.recommendations = [ -- GitLab