Skip to content

Commit

Permalink
wip: update callback api usage in tests for changes in main since 43a…
Browse files Browse the repository at this point in the history
  • Loading branch information
lawrence-forooghian committed Dec 12, 2023
1 parent 4b420c9 commit 8700889
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions test/realtime/channel.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1535,7 +1535,7 @@ define(['ably', 'shared_helper', 'async', 'chai'], function (Ably, helper, async
var realtime = helper.AblyRealtime();
var channelName = 'attach_returns_state_chnage';
var channel = realtime.channels.get(channelName);
channel.attach(function (err, stateChange) {
whenPromiseSettles(channel.attach(), function (err, stateChange) {
if (err) {
closeAndFinish(done, realtime, err);
return;
Expand All @@ -1550,7 +1550,7 @@ define(['ably', 'shared_helper', 'async', 'chai'], function (Ably, helper, async
}

// for an already-attached channel, null is returned
channel.attach(function (err, stateChange) {
whenPromiseSettles(channel.attach(), function (err, stateChange) {
if (err) {
closeAndFinish(done, realtime, err);
return;
Expand All @@ -1571,9 +1571,10 @@ define(['ably', 'shared_helper', 'async', 'chai'], function (Ably, helper, async
var realtime = helper.AblyRealtime();
var channelName = 'subscribe_returns_state_chnage';
var channel = realtime.channels.get(channelName);
channel.subscribe(
function () {}, // message listener
// attach callback
whenPromiseSettles(
channel.subscribe(
function () {} // message listener
),
function (err, stateChange) {
if (err) {
closeAndFinish(done, realtime, err);
Expand All @@ -1599,7 +1600,7 @@ define(['ably', 'shared_helper', 'async', 'chai'], function (Ably, helper, async
var channel = realtime.channels.get(channelName, channelOpts);

// attach with rewind but no channel history - hasBacklog should be false
channel.attach(function (err, stateChange) {
whenPromiseSettles(channel.attach(), function (err, stateChange) {
if (err) {
closeAndFinish(done, realtime, err);
return;
Expand All @@ -1624,12 +1625,12 @@ define(['ably', 'shared_helper', 'async', 'chai'], function (Ably, helper, async
var restChannel = rest.channels.get(channelName);

// attach with rewind after publishing - hasBacklog should be true
restChannel.publish('foo', 'bar', function (err) {
whenPromiseSettles(restChannel.publish('foo', 'bar'), function (err) {
if (err) {
closeAndFinish(done, realtime, err);
return;
}
rtChannel.attach(function (err, stateChange) {
whenPromiseSettles(rtChannel.attach(), function (err, stateChange) {
if (err) {
closeAndFinish(done, realtime, err);
return;
Expand Down

0 comments on commit 8700889

Please sign in to comment.