From dc412b305c8eac563ca223bc3e2c4d6fce74df8f Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 1 Jun 2020 13:46:07 +0100 Subject: [PATCH] Tidy up unhandledRejection warning from context unit tests --- test/unit/@node-red/editor-api/lib/admin/context_spec.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/unit/@node-red/editor-api/lib/admin/context_spec.js b/test/unit/@node-red/editor-api/lib/admin/context_spec.js index a9dc0f70d..8f3dbba55 100644 --- a/test/unit/@node-red/editor-api/lib/admin/context_spec.js +++ b/test/unit/@node-red/editor-api/lib/admin/context_spec.js @@ -127,7 +127,9 @@ describe("api/admin/context", function () { }); it('should handle error which context.getValue causes', function (done) { - stub.returns(Promise.reject('error')); + var stubbedResult = Promise.reject('error'); + stubbedResult.catch(function() {}); + stub.returns(stubbedResult); request(app) .get('/context/global') .set('Accept', 'application/json') @@ -213,7 +215,9 @@ describe("api/admin/context", function () { }); it('should handle error which context.delete causes', function (done) { - stub.returns(Promise.reject('error')); + var stubbedResult = Promise.reject('error'); + stubbedResult.catch(function() {}); + stub.returns(stubbedResult); request(app) .delete('/context/global/abc?store=default') .expect(400)