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 Jun 10, 2024
1 parent 026efbe commit a89c646
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 @@ -46,7 +46,7 @@ define(['ably', 'shared_helper', 'chai'], function (Ably, helper, chai) {

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 @@ -61,7 +61,7 @@ define(['ably', 'shared_helper', 'chai'], function (Ably, helper, chai) {

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 @@ -75,7 +75,7 @@ define(['ably', 'shared_helper', 'chai'], function (Ably, helper, chai) {

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 @@ -88,22 +88,19 @@ define(['ably', 'shared_helper', 'chai'], function (Ably, helper, chai) {
});

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);
}
});
});

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 @@ -117,7 +114,7 @@ define(['ably', 'shared_helper', 'chai'], function (Ably, helper, chai) {

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 @@ -132,7 +129,7 @@ define(['ably', 'shared_helper', 'chai'], function (Ably, helper, chai) {

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 a89c646

Please sign in to comment.