From c9cfcddbe9ffaeff7bc8fd0450b949c1fddf439c Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 22 Jul 2016 11:54:16 +0100 Subject: [PATCH] test error case for inviteToProject --- .../CollaboratorsInviteHandlerTests.coffee | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/services/web/test/UnitTests/coffee/Collaborators/CollaboratorsInviteHandlerTests.coffee b/services/web/test/UnitTests/coffee/Collaborators/CollaboratorsInviteHandlerTests.coffee index d38d7a2a72..f4e3db64da 100644 --- a/services/web/test/UnitTests/coffee/Collaborators/CollaboratorsInviteHandlerTests.coffee +++ b/services/web/test/UnitTests/coffee/Collaborators/CollaboratorsInviteHandlerTests.coffee @@ -79,3 +79,13 @@ describe "CollaboratorsInviteHandler", -> @CollaboratorsEmailHandler.notifyUserOfProjectInvite.callCount.should.equal 1 @CollaboratorsEmailHandler.notifyUserOfProjectInvite.calledWith(@projectId, @email).should.equal true done() + + describe 'when saving model produces an error', -> + + beforeEach -> + @ProjectInvite::save = sinon.spy (cb) -> cb(new Error('woops'), this) + + it 'should produce an error', (done) -> + @call (err, invite) => + expect(err).to.be.instanceof Error + done()