From f6a374c28daeb743a903aede79150277e549ab56 Mon Sep 17 00:00:00 2001 From: Jim Zhang Date: Sat, 18 Feb 2017 12:16:45 -0500 Subject: [PATCH] Move t.end() calls earlier to avoid confusion The orderer.js tests contain asynchronous calls that are expected to fail because of the negative tests. Currently the t.end() call is placed at the outside of the callbacks, this results in the error being printed AFTER the success printouts for the test suite. This is confusing when running `gulp test-headless` because errors get printed out after the summary table and it may appear that the test run has failed. Change-Id: I35cee62ed0514a6075f31b50a1d911546e153362 Signed-off-by: Jim Zhang --- test/unit/orderer.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/unit/orderer.js b/test/unit/orderer.js index 608a7e7ac7..fbba516e54 100644 --- a/test/unit/orderer.js +++ b/test/unit/orderer.js @@ -87,15 +87,17 @@ test('orderer missing data test', function(t) { function(status) { console.log('response status: ' + JSON.stringify(status)); t.fail('Should have noticed missing data.'); + t.end(); }, function(err) { console.log('Caught Error: ' + err); t.pass('Successfully found missing data: ' + err); + t.end(); } ).catch(function(err) { t.fail('Caught Error: should not be here if we defined promise error function: ' + err); + t.end(); }); - t.end(); }); // @@ -113,13 +115,15 @@ test('orderer unknown address test', function(t) { function(status) { console.log('response status: ' + JSON.stringify(status)); t.fail('Should have noticed a bad address.'); + t.end(); }, function(err) { t.pass('Successfully found bad address!'); + t.end(); } ).catch(function(err) { t.fail('Caught Error: should not be here if we defined promise error function: ' + err); + t.end(); }); - t.end(); });