From 429da3bef08086a2d751af1439f0df2a3e009fc9 Mon Sep 17 00:00:00 2001 From: James Smith Date: Thu, 31 May 2018 12:07:51 +0100 Subject: [PATCH] add check for total request failure --- test/management/jobs.tests.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/management/jobs.tests.js b/test/management/jobs.tests.js index 432f3d203..c273fbfb2 100644 --- a/test/management/jobs.tests.js +++ b/test/management/jobs.tests.js @@ -175,6 +175,19 @@ describe('JobsManager', function() { .catch(done.bind(null, null)); }); + it('should pass request errors to the promise catch handler', function(done) { + nock.cleanAll(); + + var request = nock(API_URL) + .post('/jobs/users-imports') + .replyWithError('printer on fire'); + + this.jobs.importUsers(data).catch(function(err) { + expect(err.message).to.equal('printer on fire'); + done(); + }); + }); + it('should pass HTTP errors to the promise catch handler', function(done) { nock.cleanAll();