Skip to content

Commit

Permalink
fix: missing get and set methods for userId are added
Browse files Browse the repository at this point in the history
  • Loading branch information
mohitpubnub committed Aug 21, 2023
1 parent 9584344 commit 836f36d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions dist/web/pubnub.js
Original file line number Diff line number Diff line change
Expand Up @@ -7710,6 +7710,8 @@
this.setCipherKey = modules.config.setCipherKey.bind(modules.config);
this.getUUID = modules.config.getUUID.bind(modules.config);
this.setUUID = modules.config.setUUID.bind(modules.config);
this.getUserId = modules.config.getUserId.bind(modules.config);
this.setUserId = modules.config.setUserId.bind(modules.config);
this.getFilterExpression = modules.config.getFilterExpression.bind(modules.config);
this.setFilterExpression = modules.config.setFilterExpression.bind(modules.config);
this.setHeartbeatInterval = modules.config.setHeartbeatInterval.bind(modules.config);
Expand Down
2 changes: 1 addition & 1 deletion dist/web/pubnub.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions lib/core/pubnub-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,8 @@ var default_1 = /** @class */ (function () {
this.setCipherKey = modules.config.setCipherKey.bind(modules.config);
this.getUUID = modules.config.getUUID.bind(modules.config);
this.setUUID = modules.config.setUUID.bind(modules.config);
this.getUserId = modules.config.getUserId.bind(modules.config);
this.setUserId = modules.config.setUserId.bind(modules.config);
this.getFilterExpression = modules.config.getFilterExpression.bind(modules.config);
this.setFilterExpression = modules.config.setFilterExpression.bind(modules.config);
this.setHeartbeatInterval = modules.config.setHeartbeatInterval.bind(modules.config);
Expand Down
6 changes: 6 additions & 0 deletions src/core/pubnub-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ export default class {

getUUID;

setUserId;

getUserId;

getFilterExpression;

setFilterExpression;
Expand Down Expand Up @@ -669,6 +673,8 @@ export default class {
this.setCipherKey = modules.config.setCipherKey.bind(modules.config);
this.getUUID = modules.config.getUUID.bind(modules.config);
this.setUUID = modules.config.setUUID.bind(modules.config);
this.getUserId = modules.config.getUserId.bind(modules.config);
this.setUserId = modules.config.setUserId.bind(modules.config);
this.getFilterExpression = modules.config.getFilterExpression.bind(modules.config);
this.setFilterExpression = modules.config.setFilterExpression.bind(modules.config);

Expand Down
11 changes: 11 additions & 0 deletions test/integration/components/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ describe('components/config', () => {
assert.equal(pubnub.getUUID(), 'uuid2');
});

it('get/set userId', () => {
let pubnub = new PubNub({
subscribeKey: 'mySubKey',
publishKey: 'myPublishKey',
userId: 'userId1',
});
assert.equal(pubnub.getUserId(), 'userId1');
pubnub.setUserId('userId2');
assert.equal(pubnub.getUserId(), 'userId2');
});

it('throws when both userId and uuid are provided', () => {
let config = { subscribeKey: 'demo', publishKey: 'demo', uuid: 'myUuid', userId: 'myUserId' };

Expand Down

0 comments on commit 836f36d

Please sign in to comment.