Skip to content

Commit

Permalink
Remove parts of test relating to setOptions calling its callback imme…
Browse files Browse the repository at this point in the history
…diately

As part of #1213, I’ll be updating this test to use the Promise-based
API, to which the concept of "calls the callback before returning" can’t
be detected, since the JavaScript engine always calls Promise callbacks
asynchronously.
  • Loading branch information
lawrence-forooghian committed Jun 27, 2023
1 parent cbbe3b1 commit f744893
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions test/realtime/channel.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -686,23 +686,6 @@ define(['ably', 'shared_helper', 'async', 'chai'], function (Ably, helper, async

async.series(
[
function (cb) {
var setOptionsReturned = false;
channel.setOptions(
{
params: params,
modes: modes,
},
function () {
expect(
!setOptionsReturned,
'setOptions failed to call back immediately, when no reattach is required'
).to.be.ok;
cb();
}
);
setOptionsReturned = true;
},
function (cb) {
channel.attach(cb);
},
Expand All @@ -715,7 +698,6 @@ define(['ably', 'shared_helper', 'async', 'chai'], function (Ably, helper, async
channelUpdated = true;
});

var setOptionsReturned = false;
channel.setOptions(
{
params: params,
Expand All @@ -724,10 +706,6 @@ define(['ably', 'shared_helper', 'async', 'chai'], function (Ably, helper, async
/* Wait a tick so we don' depend on whether the update event runs the
* channelUpdated listener or the setOptions listener first */
Ably.Realtime.Platform.Config.nextTick(function () {
expect(
setOptionsReturned,
'setOptions should return immediately and call back after the reattach'
).to.be.ok;
expect(
channelUpdated,
'Check channel went to the server to update the channel params'
Expand All @@ -736,42 +714,24 @@ define(['ably', 'shared_helper', 'async', 'chai'], function (Ably, helper, async
});
}
);
setOptionsReturned = true;
},
function (cb) {
var channelUpdated = false;
channel._allChannelChanges.on(['attached', 'update'], function () {
channelUpdated = true;
});

var setOptionsReturned = false;
channel.setOptions(
{
modes: modes,
},
function () {
Ably.Realtime.Platform.Config.nextTick(function () {
expect(
setOptionsReturned,
'setOptions should return immediately and call back after the reattach'
).to.be.ok;
expect(channelUpdated, 'Check channel went to the server to update the channel mode').to.be.ok;
cb();
});
}
);
setOptionsReturned = true;
},
function (cb) {
var setOptionsReturned = false;
channel.setOptions({}, function () {
expect(
!setOptionsReturned,
'setOptions failed to call back immediately, when no reattach is required'
).to.be.ok;
cb();
});
setOptionsReturned = true;
},
],
function (err) {
Expand Down

0 comments on commit f744893

Please sign in to comment.