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

feat(component-invite): fix invite tests

parent 9314b8ae
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,7 @@ module.exports = async (body, models, res, url) => { ...@@ -26,7 +26,7 @@ module.exports = async (body, models, res, url) => {
return res.status(500).json({ error: e.details[0].message }) return res.status(500).json({ error: e.details[0].message })
} }
return userHelper.setupNewUser( const newUser = await userHelper.setupNewUser(
body, body,
url, url,
res, res,
...@@ -35,5 +35,13 @@ module.exports = async (body, models, res, url) => { ...@@ -35,5 +35,13 @@ module.exports = async (body, models, res, url) => {
models.User, models.User,
'invite', 'invite',
) )
if (newUser.error !== undefined) {
return res.status(newUser.status).json({
error: newUser.message,
})
}
return res.status(200).json(newUser)
} }
} }
...@@ -8,7 +8,7 @@ module.exports = { ...@@ -8,7 +8,7 @@ module.exports = {
title: 'Standard Collection', title: 'Standard Collection',
type: 'collection', type: 'collection',
fragments: [], fragments: [],
owners: [], owners: [submittingAuthor.id],
save: jest.fn(), save: jest.fn(),
assignedPeople: [ assignedPeople: [
{ {
......
...@@ -15,4 +15,8 @@ module.exports = { ...@@ -15,4 +15,8 @@ module.exports = {
firstName: chance.first(), firstName: chance.first(),
lastName: chance.last(), lastName: chance.last(),
}, },
admin: {
id: chance.guid(),
email: chance.email(),
},
} }
const { standardCollection } = require('./collections') const { standardCollection } = require('./collections')
const { heTeamID, reviewerTeamID } = require('./teamIDs') const { heTeamID, reviewerTeamID } = require('./teamIDs')
const { handlingEditor, submittingAuthor } = require('./userData') const { handlingEditor, submittingAuthor, admin } = require('./userData')
const Chance = require('chance') const Chance = require('chance')
const chance = new Chance() const chance = new Chance()
...@@ -8,10 +8,10 @@ const users = { ...@@ -8,10 +8,10 @@ const users = {
admin: { admin: {
type: 'user', type: 'user',
username: 'admin', username: 'admin',
email: 'admin@example.com', email: admin.email,
password: 'test', password: 'test',
admin: true, admin: true,
id: 'admin123', id: admin.id,
}, },
editorInChief: { editorInChief: {
type: 'user', type: 'user',
......
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