From 03c96e6a458c9a9b3fe5b487c975170c663e7cfe Mon Sep 17 00:00:00 2001 From: Sebastian <sebastian.mihalache@thinslices.com> Date: Fri, 19 Jan 2018 13:23:04 +0200 Subject: [PATCH] added success test --- .../xpub-faraday-server/src/AuthorBackend.test.js | 7 +++++++ .../xpub-faraday-server/src/fixtures/fixtures.js | 14 +++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/xpub-faraday-server/src/AuthorBackend.test.js b/packages/xpub-faraday-server/src/AuthorBackend.test.js index 4431bbf9a..604631040 100644 --- a/packages/xpub-faraday-server/src/AuthorBackend.test.js +++ b/packages/xpub-faraday-server/src/AuthorBackend.test.js @@ -66,4 +66,11 @@ describe('Author Backend API', () => { .post('/api/fragments/123-valid-id/authors') .send(fixtures.newSubmittingAuthor) .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())) }) diff --git a/packages/xpub-faraday-server/src/fixtures/fixtures.js b/packages/xpub-faraday-server/src/fixtures/fixtures.js index d265352b1..8f9abc779 100644 --- a/packages/xpub-faraday-server/src/fixtures/fixtures.js +++ b/packages/xpub-faraday-server/src/fixtures/fixtures.js @@ -5,10 +5,21 @@ const author = { email: 'email@email.com', affiliation: 'University', country: '', - isCorresponding: true, + isCorresponding: false, isSubmitting: true, } +const newAuthor = { + firstName: 'Robert', + middleName: '', + lastName: 'Smith', + email: 'email_robert@email.com', + affiliation: 'University', + country: '', + isCorresponding: true, + isSubmitting: false, +} + const invalidAuthor = { firstName: '', middleName: '', @@ -46,4 +57,5 @@ module.exports = { invalidAuthor, fragment, newSubmittingAuthor, + newAuthor, } -- GitLab