From 6c4e7bc0f6959cc2d6003c98d8bc2e3737dc6837 Mon Sep 17 00:00:00 2001 From: Austin Roberts Date: Fri, 30 Mar 2018 22:24:46 -0500 Subject: [PATCH] Fix tests for web3-provider-ws@1.0.0-beta.33 In web3-provider-ws v1.0.0-beta.33 they changed the callback behavior from cb(err, response) to cb(response), but it seems some instances make the callback without passing the error while other instances make the callback with an error and response. This change deals with both possible inputs to the callback function. An alternative might be to pin web3-provider-ws to 1.0.0-beta.30. --- test/events.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/events.js b/test/events.js index dd481a3016..55df2cc968 100644 --- a/test/events.js +++ b/test/events.js @@ -178,7 +178,12 @@ var tests = function(web3, EventTest) { let filter_id = result.result; let listener = function (err, result) { - if (err) return done(err); + if(result == undefined) { + // If there's only one argument, it's the result, not an error + result = err; + } else if (err) { + return done(err); + } first_changes = result.params.result.hash; assert.equal(first_changes.length, 66); // Ensure we have a hash provider.removeAllListeners('data')