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

fix(component-user-manager): fix missing params return

parent a8b83b55
No related branches found
No related tags found
1 merge request!8Sprint #10
const logger = require('@pubsweet/logger')
const get = require('lodash/get') const get = require('lodash/get')
const helpers = require('../../helpers/helpers') const helpers = require('../../helpers/helpers')
const collectionHelper = require('../../helpers/Collection') const collectionHelper = require('../../helpers/Collection')
...@@ -10,11 +9,8 @@ module.exports = models => async (req, res) => { ...@@ -10,11 +9,8 @@ module.exports = models => async (req, res) => {
if ( if (
!helpers.checkForUndefinedParams(email, role, isSubmitting, isCorresponding) !helpers.checkForUndefinedParams(email, role, isSubmitting, isCorresponding)
) { )
res.status(400).json({ error: 'Email and role are required' }) return res.status(400).json({ error: 'Missing parameters.' })
logger.error('Email and role are missing')
return
}
const collectionId = get(req, 'params.collectionId') const collectionId = get(req, 'params.collectionId')
let collection let collection
......
...@@ -87,7 +87,7 @@ describe('Post collections users route handler', () => { ...@@ -87,7 +87,7 @@ describe('Post collections users route handler', () => {
expect(res.statusCode).toBe(400) expect(res.statusCode).toBe(400)
const data = JSON.parse(res._getData()) const data = JSON.parse(res._getData())
expect(data.error).toEqual('Email and role are required') expect(data.error).toEqual('Missing parameters.')
body.email = author.email body.email = author.email
}) })
it('should return an error when the role is not author and the user exists', async () => { it('should return an error when the role is not author and the user exists', async () => {
......
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