From 2b7c2f50d651f782743eb1c7870a909b395cb5ba Mon Sep 17 00:00:00 2001 From: Lawrence Forooghian Date: Mon, 10 Jun 2024 10:03:05 -0300 Subject: [PATCH] Stop using helper.AblyRealtime as a constructor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It isn’t intended be called as a constructor. --- test/realtime/connectivity.test.js | 31 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/test/realtime/connectivity.test.js b/test/realtime/connectivity.test.js index a4832946a..c19e3e077 100644 --- a/test/realtime/connectivity.test.js +++ b/test/realtime/connectivity.test.js @@ -49,7 +49,7 @@ define(['ably', 'shared_helper', 'chai'], function (Ably, helper, chai) { /** @nospec */ it('succeeds with scheme', function (done) { helper.whenPromiseSettles( - new helper.AblyRealtime(options(urlScheme + successUrl)).http.checkConnectivity(), + helper.AblyRealtime(options(urlScheme + successUrl)).http.checkConnectivity(), function (err, res) { try { expect(res && !err, 'Connectivity check completed ' + (err && helper.Utils.inspectError(err))).to.be.ok; @@ -65,7 +65,7 @@ define(['ably', 'shared_helper', 'chai'], function (Ably, helper, chai) { /** @nospec */ it('fails with scheme', function (done) { helper.whenPromiseSettles( - new helper.AblyRealtime(options(urlScheme + failUrl)).http.checkConnectivity(), + helper.AblyRealtime(options(urlScheme + failUrl)).http.checkConnectivity(), function (err, res) { try { expect(!res, 'Connectivity check expected to return false').to.be.ok; @@ -80,7 +80,7 @@ define(['ably', 'shared_helper', 'chai'], function (Ably, helper, chai) { /** @nospec */ it('succeeds with querystring', function (done) { helper.whenPromiseSettles( - new helper.AblyRealtime(options(successUrl)).http.checkConnectivity(), + helper.AblyRealtime(options(successUrl)).http.checkConnectivity(), function (err, res) { try { expect(res && !err, 'Connectivity check completed ' + (err && helper.Utils.inspectError(err))).to.be.ok; @@ -94,23 +94,20 @@ define(['ably', 'shared_helper', 'chai'], function (Ably, helper, chai) { /** @nospec */ it('fails with querystring', function (done) { - helper.whenPromiseSettles( - new helper.AblyRealtime(options(failUrl)).http.checkConnectivity(), - function (err, res) { - try { - expect(!res, 'Connectivity check expected to return false').to.be.ok; - done(); - } catch (err) { - done(err); - } - }, - ); + helper.whenPromiseSettles(helper.AblyRealtime(options(failUrl)).http.checkConnectivity(), function (err, res) { + try { + expect(!res, 'Connectivity check expected to return false').to.be.ok; + done(); + } catch (err) { + done(err); + } + }); }); /** @nospec */ it('succeeds with plain url', function (done) { helper.whenPromiseSettles( - new helper.AblyRealtime(options('sandbox-rest.ably.io/time')).http.checkConnectivity(), + helper.AblyRealtime(options('sandbox-rest.ably.io/time')).http.checkConnectivity(), function (err, res) { try { expect(res && !err, 'Connectivity check completed ' + (err && helper.Utils.inspectError(err))).to.be.ok; @@ -125,7 +122,7 @@ define(['ably', 'shared_helper', 'chai'], function (Ably, helper, chai) { /** @nospec */ it('fails with plain url', function (done) { helper.whenPromiseSettles( - new helper.AblyRealtime(options('echo.ably.io')).http.checkConnectivity(), + helper.AblyRealtime(options('echo.ably.io')).http.checkConnectivity(), function (err, res) { try { expect(!res, 'Connectivity check expected to return false').to.be.ok; @@ -141,7 +138,7 @@ define(['ably', 'shared_helper', 'chai'], function (Ably, helper, chai) { /** @nospec */ it('disable_connectivity_check', function (done) { helper.whenPromiseSettles( - new helper.AblyRealtime(options('notarealhost', true)).http.checkConnectivity(), + helper.AblyRealtime(options('notarealhost', true)).http.checkConnectivity(), function (err, res) { try { expect(res && !err, 'Connectivity check completed ' + (err && helper.Utils.inspectError(err))).to.be.ok;