Skip to content

Commit

Permalink
init_usetokenauth_defaulttokenparams_wildcard test: increase ttl to f…
Browse files Browse the repository at this point in the history
…ix race

with a 12s ttl, realtime was asking the lib to start a reauth as soon as
it connected. With unlucky timings, the original token details could be
cleared just before the test code looked at it.
  • Loading branch information
SimonWoolf committed Jan 23, 2023
1 parent 1bf3e44 commit e263ea6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/realtime/init.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ define(['ably', 'shared_helper', 'chai'], function (Ably, helper, chai) {
realtime = helper.AblyRealtime({
key: keyStr,
useTokenAuth: true,
defaultTokenParams: { clientId: '*', ttl: 12345 },
defaultTokenParams: { clientId: '*', ttl: 123456 },
});
expect(realtime.auth.clientId).to.equal(undefined);
realtime.connection.on('connected', function () {
try {
expect(realtime.auth.tokenDetails.clientId).to.equal('*');
/* auth.clientId now does inherit the value '*' -- RSA7b4 */
expect(realtime.auth.clientId).to.equal('*');
expect(realtime.auth.tokenDetails.expires - realtime.auth.tokenDetails.issued).to.equal(12345);
expect(realtime.auth.tokenDetails.expires - realtime.auth.tokenDetails.issued).to.equal(123456);
} catch (err) {
closeAndFinish(done, realtime, err);
return;
Expand Down

0 comments on commit e263ea6

Please sign in to comment.