@stream-io/video-client 1.42.1 → 1.42.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
1
+ import { describe, expect, it, vi } from 'vitest';
2
+ import { DispatchableMessage, Dispatcher } from '../Dispatcher';
3
+
4
+ describe('Dispatcher', () => {
5
+ it('routes events to tag listeners and wildcard listeners', () => {
6
+ const dispatcher = new Dispatcher();
7
+ const taggedListener = vi.fn();
8
+ const wildcardListener = vi.fn();
9
+
10
+ dispatcher.on('healthCheckResponse', 'tag-1', taggedListener);
11
+ dispatcher.on('healthCheckResponse', '*', wildcardListener);
12
+
13
+ const message: DispatchableMessage<'healthCheckResponse'> = {
14
+ eventPayload: {
15
+ oneofKind: 'healthCheckResponse',
16
+ healthCheckResponse: {} as never,
17
+ },
18
+ };
19
+
20
+ dispatcher.dispatch(message, 'tag-1');
21
+ expect(taggedListener).toHaveBeenCalledTimes(1);
22
+ expect(wildcardListener).toHaveBeenCalledTimes(1);
23
+
24
+ dispatcher.dispatch(message, 'tag-2');
25
+ expect(taggedListener).toHaveBeenCalledTimes(1);
26
+ expect(wildcardListener).toHaveBeenCalledTimes(2);
27
+ });
28
+ });
@@ -180,6 +180,7 @@ describe('Publisher', () => {
180
180
  },
181
181
  },
182
182
  }) as DispatchableMessage<'changePublishQuality'>,
183
+ 'test',
183
184
  );
184
185
  expect(publisher['changePublishQuality']).toHaveBeenCalled();
185
186
  });
@@ -193,6 +194,7 @@ describe('Publisher', () => {
193
194
  changePublishOptions: { publishOptions: [], reason: 'test' },
194
195
  },
195
196
  }) as DispatchableMessage<'changePublishOptions'>,
197
+ 'test',
196
198
  );
197
199
  expect(publisher['syncPublishOptions']).toHaveBeenCalled();
198
200
  });
@@ -210,6 +212,7 @@ describe('Publisher', () => {
210
212
  },
211
213
  },
212
214
  }) as DispatchableMessage<'iceRestart'>,
215
+ 'test',
213
216
  );
214
217
  expect(publisher.restartIce).toHaveBeenCalled();
215
218
  });
@@ -36,7 +36,7 @@ describe('Subscriber', () => {
36
36
  sessionId: 'sessionId',
37
37
  streamClient: new StreamClient('abc'),
38
38
  cid: 'test:123',
39
- tag: 'logTag',
39
+ tag: 'test',
40
40
  credentials: {
41
41
  server: {
42
42
  url: 'https://getstream.io/',
@@ -255,6 +255,7 @@ describe('Subscriber', () => {
255
255
  subscriberOffer,
256
256
  },
257
257
  }) as DispatchableMessage<'subscriberOffer'>,
258
+ 'test',
258
259
  );
259
260
 
260
261
  // @ts-expect-error - private method