-
Notifications
You must be signed in to change notification settings - Fork 61
fix: implement RTC17 clientId #2100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds a public getter Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ebee036 to
10f1553
Compare
We currently have the RTC17 clientId declared in `ably.d.ts` but it's not implemented anywhere, so it always returns undefined. This change adds a getter to `BaseRealtime`.
10f1553 to
6f33494
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
test/realtime/auth.test.js (1)
1317-1349: LGTM! Test correctly verifies RTC17 spec.The test properly verifies that the new
realtime.clientIdgetter returns the expected value fromauth.clientId. The implementation follows established patterns and includes appropriate error handling.Optional: Consider reducing duplication with existing test.
This test is nearly identical to
auth_jwt_with_clientid(lines 1216-1245), with the only difference being the use ofrealtime.clientIdinstead ofrealtime.auth.clientId. Consider consolidating these tests or extracting common logic to reduce maintenance burden:/** * @spec RSA7b3 * @spec RTC17 * @specpartial RSA8g - authCallback returned JWT token string */ it('auth_jwt_with_clientid', function (done) { const helper = this.test.helper; var currentKey = helper.getTestApp().keys[0]; var keys = { keyName: currentKey.keyName, keySecret: currentKey.keySecret }; var clientId = 'testJWTClientId'; helper.recordPrivateApi('call.Utils.mixin'); var params = helper.Utils.mixin(keys, { clientId: clientId }); var authCallback = function (tokenParams, callback) { getJWT(params, helper, callback); }; var realtime = helper.AblyRealtime({ authCallback: authCallback }); realtime.connection.on('connected', function () { try { expect(realtime.auth.clientId).to.equal(clientId); // RTC17: Verify realtime.clientId getter mirrors auth.clientId expect(realtime.clientId).to.equal(clientId); realtime.connection.close(); done(); } catch (err) { done(err); } return; }); realtime.connection.on('failed', function (err) { realtime.close(); done(err); return; }); });This approach would reduce code duplication while maintaining comprehensive test coverage for both the auth clientId and the RTC17 getter.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
src/common/lib/client/baserealtime.ts(1 hunks)test/realtime/auth.test.js(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/common/lib/client/baserealtime.ts
🧰 Additional context used
🧬 Code graph analysis (1)
test/realtime/auth.test.js (1)
src/common/lib/client/baserealtime.ts (1)
clientId(86-89)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: test-browser (webkit)
- GitHub Check: test-node (18.x)
- GitHub Check: test-node (16.x)
- GitHub Check: test-node (20.x)
- GitHub Check: test-npm-package
- GitHub Check: test-browser (firefox)
- GitHub Check: test-browser (chromium)
We currently have the RTC17 clientId declared in
ably.d.tsbut it's not implemented anywhere, so it always returns undefined. This change adds a getter toBaseRealtime.Summary by CodeRabbit
New Features
Tests