From 669f3d9ba1293a1a27fca40ad1f431f09f60d2a4 Mon Sep 17 00:00:00 2001 From: Mark Hindess Date: Tue, 30 Sep 2014 14:59:37 +0100 Subject: [PATCH] Fix supertest usage to correctly throw errors. --- test/nodes/core/core/20-inject_spec.js | 9 ++++++++- test/nodes/core/core/58-debug_spec.js | 9 +++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/test/nodes/core/core/20-inject_spec.js b/test/nodes/core/core/20-inject_spec.js index 0813f1c83..aeeac9dda 100644 --- a/test/nodes/core/core/20-inject_spec.js +++ b/test/nodes/core/core/20-inject_spec.js @@ -100,7 +100,14 @@ describe('inject node', function() { }); helper.request() .post('/inject/n1') - .expect(200).end(function() {}); + .expect(200).end(function(err) { + if (err) { + return helper.clearFlows() + .then(function () { + done(err); + }); + } + }); }); }); diff --git a/test/nodes/core/core/58-debug_spec.js b/test/nodes/core/core/58-debug_spec.js index dc667a69f..f83fc2ca0 100644 --- a/test/nodes/core/core/58-debug_spec.js +++ b/test/nodes/core/core/58-debug_spec.js @@ -231,7 +231,8 @@ describe('debug node', function() { n1.emit("input", {payload:"message 1"}); helper.request() .post('/debug/n1/enable') - .expect(200).end(function() { + .expect(200).end(function(err) { + if (err) { return done(err); } n1.emit("input", {payload:"message 2"}); }); }, function(msg) { @@ -249,7 +250,11 @@ describe('debug node', function() { websocket_test(function(close) { helper.request() .post('/debug/n1/disable') - .expect(200).end(function() { + .expect(201).end(function(err) { + if (err) { + close(); + return done(err); + } n1.emit("input", {payload:"message"}); setTimeout(function() { close();