Skip to content
Snippets Groups Projects
Commit b4b3de30 authored by Bogdan Cochior's avatar Bogdan Cochior
Browse files

refactor(authsome-helpers): do not mutate object

parent ee959724
No related branches found
No related tags found
1 merge request!13Sprint #14
...@@ -142,7 +142,7 @@ const stripeCollectionByRole = (coll = {}, role = '') => { ...@@ -142,7 +142,7 @@ const stripeCollectionByRole = (coll = {}, role = '') => {
const { handlingEditor } = coll const { handlingEditor } = coll
if (!authorAllowedStatuses.includes(coll.status)) { if (!authorAllowedStatuses.includes(coll.status)) {
coll = { return {
...coll, ...coll,
handlingEditor: handlingEditor && handlingEditor: handlingEditor &&
handlingEditor.isAccepted && { handlingEditor.isAccepted && {
......
...@@ -136,7 +136,7 @@ describe('Authsome Helpers', () => { ...@@ -136,7 +136,7 @@ describe('Authsome Helpers', () => {
}) })
expect(recommendations).toHaveLength(0) expect(recommendations).toHaveLength(0)
}) })
it('stripeFragment - author should see reviews only if recommendation has been made', () => { it('stripeFragment - author should see reviews only if recommendation has been made and only public ones', () => {
const { fragment } = testFixtures.fragments const { fragment } = testFixtures.fragments
fragment.recommendations = [ fragment.recommendations = [
{ {
...@@ -157,7 +157,7 @@ describe('Authsome Helpers', () => { ...@@ -157,7 +157,7 @@ describe('Authsome Helpers', () => {
role: 'author', role: 'author',
status: 'revisionRequested', status: 'revisionRequested',
}) })
const privateComments = get(result, 'recommendations[0].comments') const publicComments = get(result, 'recommendations[0].comments')
expect(privateComments).toHaveLength(1) expect(publicComments).toHaveLength(1)
}) })
}) })
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment