From 870088923d512fa21ef935859364576a57d617f4 Mon Sep 17 00:00:00 2001 From: Lawrence Forooghian Date: Mon, 11 Dec 2023 16:28:43 -0300 Subject: [PATCH] wip: update callback api usage in tests for changes in main since 43a2d1d --- test/realtime/channel.test.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/realtime/channel.test.js b/test/realtime/channel.test.js index 1ed1aab1dc..ac745fb036 100644 --- a/test/realtime/channel.test.js +++ b/test/realtime/channel.test.js @@ -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; @@ -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; @@ -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); @@ -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; @@ -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;