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

added success test

parent e2524cd7
No related branches found
No related tags found
No related merge requests found
...@@ -66,4 +66,11 @@ describe('Author Backend API', () => { ...@@ -66,4 +66,11 @@ describe('Author Backend API', () => {
.post('/api/fragments/123-valid-id/authors') .post('/api/fragments/123-valid-id/authors')
.send(fixtures.newSubmittingAuthor) .send(fixtures.newSubmittingAuthor)
.expect(400, '{"error":"There can only be one sumbitting author"}')) .expect(400, '{"error":"There can only be one sumbitting author"}'))
it('should return success', () =>
makeApp(fixtures.fragment)
.post('/api/fragments/123-valid-id/authors')
.send(fixtures.newAuthor)
.expect(200, '')
.then(() => expect(fixtures.fragment.save).toHaveBeenCalled()))
}) })
...@@ -5,10 +5,21 @@ const author = { ...@@ -5,10 +5,21 @@ const author = {
email: 'email@email.com', email: 'email@email.com',
affiliation: 'University', affiliation: 'University',
country: '', country: '',
isCorresponding: true, isCorresponding: false,
isSubmitting: true, isSubmitting: true,
} }
const newAuthor = {
firstName: 'Robert',
middleName: '',
lastName: 'Smith',
email: 'email_robert@email.com',
affiliation: 'University',
country: '',
isCorresponding: true,
isSubmitting: false,
}
const invalidAuthor = { const invalidAuthor = {
firstName: '', firstName: '',
middleName: '', middleName: '',
...@@ -46,4 +57,5 @@ module.exports = { ...@@ -46,4 +57,5 @@ module.exports = {
invalidAuthor, invalidAuthor,
fragment, fragment,
newSubmittingAuthor, newSubmittingAuthor,
newAuthor,
} }
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