Skip to content
Snippets Groups Projects
Commit 573a8422 authored by Anca Ursachi's avatar Anca Ursachi
Browse files

fix(fixPipelineProblems):

parent 55a2e200
No related branches found
No related tags found
1 merge request!111Hin 1059
......@@ -4,10 +4,8 @@ const logger = require('@pubsweet/logger')
const statuses = config.get('statuses')
const keysToOmit = ['email', 'id']
const publicStatusesPermissions = ['author', 'reviewer']
const authorAllowedStatuses = ['revisionRequested', 'rejected', 'accepted']
const authorCanViewHENameStatuses = ['rejected', 'accepted']
const parseAuthorsData = (coll, matchingCollPerm) => {
if (['reviewer'].includes(matchingCollPerm.permission)) {
......
......@@ -9,90 +9,6 @@ describe('Authsome Helpers', () => {
testFixtures = cloneDeep(fixturesService.fixtures)
models = fixturesService.Model.build(testFixtures)
})
it('stripeCollection - should return collection', () => {
const { collection } = testFixtures.collections
const result = ah.stripeCollectionByRole({ collection })
expect(result).toBeTruthy()
})
it('stripeFragment - should return fragment', () => {
const { fragment } = testFixtures.fragments
const result = ah.stripeFragmentByRole({ fragment })
expect(result).toBeTruthy()
})
it('stripeCollection - author should not see accepted HE name before recommendation made', () => {
const { collection } = testFixtures.collections
collection.status = 'underReview'
collection.handlingEditor = {
...collection.handlingEditor,
isAccepted: true,
}
const role = 'author'
const result = ah.stripeCollectionByRole({ collection, role })
const { handlingEditor = {} } = result
expect(handlingEditor.email).toBeFalsy()
expect(handlingEditor.name).toEqual('Assigned')
})
it('stripeCollection - author should not see Assigned until HE accepted ', () => {
const { collection } = testFixtures.collections
collection.status = 'underReview'
collection.handlingEditor = {
...collection.handlingEditor,
isAccepted: false,
}
const role = 'author'
const result = ah.stripeCollectionByRole({ collection, role })
const { handlingEditor = {} } = result
expect(handlingEditor).toBeFalsy()
expect(handlingEditor.name).not.toEqual('Assigned')
})
it('stripeCollection - author should see HE name after recommendation made', () => {
const { collection } = testFixtures.collections
collection.status = 'revisionRequested'
const role = 'author'
const result = ah.stripeCollectionByRole({ collection, role })
const { handlingEditor = {} } = result
expect(handlingEditor.name).not.toEqual('Assigned')
})
it('stripeCollection - other user than author should see HE name before recommendation made', () => {
const { collection } = testFixtures.collections
collection.status = 'underReview'
const role = 'admin'
const result = ah.stripeCollectionByRole({ collection, role })
const { handlingEditor = {} } = result
expect(handlingEditor.name).not.toEqual('Assigned')
})
it('stripeCollection - other user than author should see HE name after recommendation made', () => {
const { collection } = testFixtures.collections
collection.status = 'revisionRequested'
const role = 'admin'
const result = ah.stripeCollectionByRole({ collection, role })
const { handlingEditor = {} } = result
expect(handlingEditor.name).not.toEqual('Assigned')
})
it('stripeCollection - returns if collection does not have HE', () => {
const { collection } = testFixtures.collections
delete collection.handlingEditor
const role = 'admin'
const result = ah.stripeCollectionByRole({ collection, role })
expect(result.handlingEditor).toBeFalsy()
})
describe('stripeFragmentByRole', () => {
it('reviewer should not see authors email', () => {
......
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