Skip to content
Snippets Groups Projects
Commit 81cd2b3b authored by Sebastian Mihalache's avatar Sebastian Mihalache :hammer_pick:
Browse files

feat(invite): add test for he invitation when status is revision requested

parent 042b99c2
No related branches found
No related tags found
3 merge requests!196S25 - EiC submit revision,!189S25,!177Hin 230 eic request revision
......@@ -50,7 +50,6 @@ module.exports = models => async (req, res) => {
error: 'Unauthorized.',
})
// check collection status
if (!['submitted', 'heInvited'].includes(collection.status)) {
return res.status(400).json({
error: `Cannot invite HE while collection is in the status: ${
......
......@@ -192,7 +192,36 @@ describe('Post collections invitations route handler', () => {
},
})
// expect(res.statusCode).toBe(200)
expect(res.statusCode).toBe(400)
const data = JSON.parse(res._getData())
expect(data.error).toEqual(
`Cannot invite HE while collection is in the status: ${
collection.status
}.`,
)
})
it('should return an error when the collection is in the revision requested status', async () => {
const { user, editorInChief } = testFixtures.users
const { collection } = testFixtures.collections
collection.status = 'revisionRequested'
body = {
email: user.email,
role: 'handlingEditor',
}
const res = await requests.sendRequest({
body,
userId: editorInChief.id,
route,
models,
path,
params: {
collectionId: collection.id,
},
})
expect(res.statusCode).toBe(400)
const data = JSON.parse(res._getData())
expect(data.error).toEqual(
......
......@@ -27,7 +27,7 @@ module.exports = models => async (req, res) => {
const reqUser = await models.User.find(req.user)
const userId = reqUser.id
// console.log('REQ USER', reqUser)
const isEditorInChief = reqUser.editorInChief || reqUser.admin
const { collectionId, fragmentId } = req.params
......
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