Skip to content

Commit e34bfc5

Browse files
test(user-agent): fix StreamChat.getUserAgent post-merge
1 parent 93d2676 commit e34bfc5

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

test/unit/client.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -643,10 +643,19 @@ describe('StreamChat.queryChannels', async () => {
643643
});
644644

645645
describe('X-Stream-Client header', () => {
646-
process.env.PKG_VERSION = '1.2.3';
647-
process.env.CLIENT_BUNDLE = 'browser-esm';
648646
let client;
649647

648+
before(() => {
649+
process.env.PKG_VERSION = '1.2.3';
650+
process.env.CLIENT_BUNDLE = 'browser-esm';
651+
});
652+
653+
after(() => {
654+
// clean up
655+
process.env.PKG_VERSION = undefined;
656+
process.env.CLIENT_BUNDLE = undefined;
657+
});
658+
650659
beforeEach(async () => {
651660
client = await getClientWithUser();
652661
});
@@ -664,7 +673,7 @@ describe('X-Stream-Client header', () => {
664673
expect(userAgent).to.be.equal('stream-chat-js-v1.2.3-browser|client_bundle=browser-esm');
665674
});
666675

667-
it('SDK integration without deviceIdentifier', () => {
676+
it('SDK integration', () => {
668677
client.sdkIdentifier = { name: 'react', version: '2.3.4' };
669678
const userAgent = client.getUserAgent();
670679

@@ -676,15 +685,9 @@ describe('X-Stream-Client header', () => {
676685
client.deviceIdentifier = { os: 'iOS 15.0', model: 'iPhone17,4' };
677686
const userAgent = client.getUserAgent();
678687

679-
expect(userAgent).to.be.equal('stream-chat-react-native-v2.3.4-llc-v1.2.3|os=iOS 15.0|device_model=iPhone17,4');
680-
});
681-
682-
it('SDK integration with process.env.CLIENT_BUNDLE', () => {
683-
process.env.CLIENT_BUNDLE = 'browser';
684-
client.sdkIdentifier = { name: 'react', version: '2.3.4' };
685-
const userAgent = client.getUserAgent();
686-
687-
expect(userAgent).to.be.equal('stream-chat-react-v2.3.4-llc-v1.2.3|client_bundle=browser');
688+
expect(userAgent).to.be.equal(
689+
'stream-chat-react-native-v2.3.4-llc-v1.2.3|os=iOS 15.0|device_model=iPhone17,4|client_bundle=browser-esm',
690+
);
688691
});
689692

690693
it('setUserAgent is now deprecated', () => {

0 commit comments

Comments
 (0)