Skip to content

Commit

Permalink
wip remove uses of callback api in test, missed in 43a2d1d
Browse files Browse the repository at this point in the history
  • Loading branch information
lawrence-forooghian committed Dec 11, 2023
1 parent 7e5f683 commit 17b6103
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 21 deletions.
2 changes: 1 addition & 1 deletion test/realtime/channel.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ define(['ably', 'shared_helper', 'async', 'chai'], function (Ably, helper, async
async.series(
[
function (cb) {
channel.attach(cb);
whenPromiseSettles(channel.attach(), cb);
},
function (cb) {
var channelUpdated = false;
Expand Down
2 changes: 1 addition & 1 deletion test/realtime/crypto.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ define(['ably', 'shared_helper', 'async', 'chai'], function (Ably, helper, async
});
}

channel.attach(function (err) {
whenPromiseSettles(channel.attach(), function (err) {
if (err) {
closeAndFinish(done, realtime, err);
return;
Expand Down
4 changes: 2 additions & 2 deletions test/realtime/failure.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ define(['ably', 'shared_helper', 'async', 'chai'], function (Ably, helper, async
});
},
function (callback) {
failChan.presence.subscribe('event', noop, function (err) {
whenPromiseSettles(failChan.presence.subscribe('event', noop), function (err) {
try {
expect(err, 'presence subscribe failed').to.be.ok;
expect(err.code).to.equal(channelFailedCode, 'subscribe failure code');
Expand All @@ -295,7 +295,7 @@ define(['ably', 'shared_helper', 'async', 'chai'], function (Ably, helper, async
});
},
function (callback) {
failChan.presence.subscribe('event', noop, function (err) {
whenPromiseSettles(failChan.presence.subscribe('event', noop), function (err) {
try {
expect(err, 'presence unsubscribe failed').to.be.ok;
expect(err.code).to.equal(channelFailedCode, 'subscribe failure code');
Expand Down
7 changes: 3 additions & 4 deletions test/realtime/message.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,12 +607,11 @@ define(['ably', 'shared_helper', 'async', 'chai'], function (Ably, helper, async
var realtime = helper.AblyRealtime(realtimeOpts);
var channel = realtime.channels.get('publish ' + JSON.stringify(realtimeOpts));
/* subscribe to event */
channel.subscribe(
'event0',
function () {
whenPromiseSettles(
channel.subscribe('event0', function () {
--count;
checkFinish();
},
}),
function () {
var dataFn = function () {
return 'Hello world at: ' + new Date();
Expand Down
10 changes: 5 additions & 5 deletions test/realtime/shared/delta_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ define(['shared_helper', 'async', 'chai'], function (helper, async, chai) {
});

async.timesSeries(testData.length, function (i, cb) {
channel.publish(i.toString(), testData[i], cb);
whenPromiseSettles(channel.publish(i.toString(), testData[i]), cb);
});
});

Expand Down Expand Up @@ -129,7 +129,7 @@ define(['shared_helper', 'async', 'chai'], function (helper, async, chai) {
});

async.timesSeries(testData.length, function (i, cb) {
channel.publish(i.toString(), testData[i], cb);
whenPromiseSettles(channel.publish(i.toString(), testData[i]), cb);
});
});

Expand Down Expand Up @@ -193,7 +193,7 @@ define(['shared_helper', 'async', 'chai'], function (helper, async, chai) {
});

async.timesSeries(testData.length, function (i, cb) {
channel.publish(i.toString(), testData[i], cb);
whenPromiseSettles(channel.publish(i.toString(), testData[i]), cb);
});
});

Expand Down Expand Up @@ -241,7 +241,7 @@ define(['shared_helper', 'async', 'chai'], function (helper, async, chai) {
});

async.timesSeries(testData.length, function (i, cb) {
channel.publish(i.toString(), testData[i], cb);
whenPromiseSettles(channel.publish(i.toString(), testData[i]), cb);
});
});

Expand Down Expand Up @@ -273,7 +273,7 @@ define(['shared_helper', 'async', 'chai'], function (helper, async, chai) {
closeAndFinish(done, realtime);
});
async.timesSeries(testData.length, function (i, cb) {
channel.publish(i.toString(), testData[i], cb);
whenPromiseSettles(channel.publish(i.toString(), testData[i]), cb);
});
});

Expand Down
14 changes: 6 additions & 8 deletions test/realtime/upgrade.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,11 @@ define(['shared_helper', 'async', 'chai', 'ably'], function (helper, async, chai
var realtime = helper.AblyRealtime(transportOpts);
var channel = realtime.channels.get('upgradepublish0');
/* subscribe to event */
channel.subscribe(
'event0',
function () {
whenPromiseSettles(
channel.subscribe('event0', function () {
--count;
checkFinish();
},
}),
function () {
var dataFn = function () {
return 'Hello world at: ' + new Date();
Expand Down Expand Up @@ -257,12 +256,11 @@ define(['shared_helper', 'async', 'chai', 'ably'], function (helper, async, chai
var realtime = helper.AblyRealtime(transportOpts);
var channel = realtime.channels.get('upgradepublish1');
/* subscribe to event */
channel.subscribe(
'event0',
function () {
whenPromiseSettles(
channel.subscribe('event0', function () {
--count;
checkFinish();
},
}),
function () {
var dataFn = function () {
return 'Hello world at: ' + new Date();
Expand Down

0 comments on commit 17b6103

Please sign in to comment.