Skip to content

Commit

Permalink
Stop using helper.AblyRealtime as a constructor
Browse files Browse the repository at this point in the history
It isn’t intended be called as a constructor.
  • Loading branch information
lawrence-forooghian committed Jul 24, 2024
1 parent 3ddc825 commit 2b7c2f5
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions test/realtime/connectivity.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 2b7c2f5

Please sign in to comment.