1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix supertest usage to correctly throw errors.

This commit is contained in:
Mark Hindess 2014-09-30 14:59:37 +01:00
parent 4f496c37be
commit 669f3d9ba1
2 changed files with 15 additions and 3 deletions

View File

@ -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);
});
}
});
});
});

View File

@ -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();