From d8c6ec6850388e483fae2035d81c980c5681e23d Mon Sep 17 00:00:00 2001 From: Marc Vila Date: Fri, 2 Jun 2023 15:14:09 +0000 Subject: [PATCH 1/2] Update README.md update readme for being consistent in startServer / stopServer calls. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 525a25e..75ca28d 100644 --- a/README.md +++ b/README.md @@ -395,14 +395,14 @@ Starts a Node-RED server for testing nodes that depend on http or web sockets en To start a Node-RED server before all test cases: ```javascript -before(function(done) { +beforeEach(function(done) { helper.startServer(done); }); ``` ### stopServer(done) -Stop server. Generally called after unload() complete. For example, to unload a flow then stop a server after each test: +Stop server. Generally called after unload() complete. For example, to unload a flow then stop a server after each test: ```javascript afterEach(function(done) { From f1c6b5b938466cac83e242fab6055b5d6533f4f3 Mon Sep 17 00:00:00 2001 From: Marc Vila Date: Fri, 2 Jun 2023 17:51:37 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 75ca28d..59b64d0 100644 --- a/README.md +++ b/README.md @@ -357,6 +357,12 @@ Updates the currently loaded flow. This function has the following arguments: Return promise to stop all flows, clean up test runtime. +```javascript +afterEach(function() { + helper.unload(); +}); +``` + ### getNode(id) Returns a node instance by id in the testFlow. Any node that is defined in testFlows can be retrieved, including any helper node added to the flow. @@ -395,7 +401,7 @@ Starts a Node-RED server for testing nodes that depend on http or web sockets en To start a Node-RED server before all test cases: ```javascript -beforeEach(function(done) { +before(function(done) { helper.startServer(done); }); ``` @@ -405,10 +411,8 @@ beforeEach(function(done) { Stop server. Generally called after unload() complete. For example, to unload a flow then stop a server after each test: ```javascript -afterEach(function(done) { - helper.unload().then(function() { - helper.stopServer(done); - }); +after(function(done) { + helper.stopServer(done); }); ```