Skip to content
Snippets Groups Projects
Commit e0746e16 authored by Sebastian's avatar Sebastian
Browse files

feat(component-invite): handle get reviewers for new manuscript

parent 7971fe6b
No related branches found
No related tags found
1 merge request!6Agree/Decline to work on a manuscript
......@@ -25,12 +25,7 @@ module.exports = models => async (req, res) => {
models.Team,
)
if (members === undefined) {
res.status(400).json({
error: `The requested collection does not have a ${role} Team`,
})
return
}
if (members === undefined) return res.status(200).json([])
// TO DO: handle case for when the invitationID is provided
const membersData = members.map(async member => {
......
......@@ -74,7 +74,7 @@ describe('Get collection invitations route handler', () => {
const data = JSON.parse(res._getData())
expect(data.error).toEqual(`Role ${req.query.role} is invalid`)
})
it('should return an error when the collection does not have a the requested role team', async () => {
it('should return success with an empty array when the collection does not have a the requested role team', async () => {
const { editorInChief, handlingEditor } = testFixtures.users
const { collection } = testFixtures.collections
const req = httpMocks.createRequest()
......@@ -87,10 +87,8 @@ describe('Get collection invitations route handler', () => {
req.user = editorInChief.id
const res = httpMocks.createResponse()
await require(getPath)(models)(req, res)
expect(res.statusCode).toBe(400)
expect(res.statusCode).toBe(200)
const data = JSON.parse(res._getData())
expect(data.error).toEqual(
`The requested collection does not have a ${req.query.role} Team`,
)
expect(data).toHaveLength(0)
})
})
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