@webex/internal-plugin-voicea 3.12.0-next.73 → 3.12.0-next.75

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.
@@ -111,6 +111,7 @@ interface IVoiceaChannel {
111
111
  csis: number[],
112
112
  isFinal: boolean
113
113
  ) => void;
114
+ getKeepTranscriptionSubscribed: () => boolean;
114
115
  }
115
116
 
116
117
  type MeetingTranscripts = {
@@ -0,0 +1,83 @@
1
+ import MockWebex from '@webex/test-helper-mock-webex';
2
+ import {assert} from '@webex/test-helper-chai';
3
+ import sinon from 'sinon';
4
+ import Mercury from '@webex/internal-plugin-mercury';
5
+ import LLMChannel from '@webex/internal-plugin-llm';
6
+
7
+ import {VoiceaPlugin} from '@webex/internal-plugin-voicea/src/voicea-plugin';
8
+ import {VoiceaChannel} from '@webex/internal-plugin-voicea/src/voicea';
9
+
10
+ /**
11
+ * Creates a mock LLM channel for testing
12
+ * @returns {Object} Mock channel
13
+ */
14
+ function createMockLLMChannel() {
15
+ return {
16
+ isConnected: sinon.stub().returns(true),
17
+ getSocket: sinon.stub().returns({}),
18
+ getBinding: sinon.stub().returns('binding'),
19
+ getDatachannelUrl: sinon.stub().returns('datachannelUrl'),
20
+ getLocusUrl: sinon.stub().returns('locusUrl'),
21
+ isDataChannelTokenEnabled: sinon.stub().resolves(true),
22
+ on: sinon.stub(),
23
+ off: sinon.stub(),
24
+ };
25
+ }
26
+
27
+ describe('plugin-voicea', () => {
28
+ describe('VoiceaPlugin', () => {
29
+ let webex;
30
+ let plugin;
31
+
32
+ beforeEach(() => {
33
+ webex = new MockWebex({
34
+ children: {
35
+ mercury: Mercury,
36
+ llm: LLMChannel,
37
+ },
38
+ });
39
+
40
+ plugin = new VoiceaPlugin({}, {parent: webex});
41
+ });
42
+
43
+ afterEach(() => sinon.restore());
44
+
45
+ describe('#createChannel', () => {
46
+ it('creates a new VoiceaChannel instance', () => {
47
+ const mockLLMChannel = createMockLLMChannel();
48
+
49
+ const channel = plugin.createChannel(mockLLMChannel);
50
+
51
+ assert.instanceOf(channel, VoiceaChannel);
52
+ });
53
+
54
+ it('creates a new VoiceaChannel instance without llmChannel', () => {
55
+ const channel = plugin.createChannel();
56
+
57
+ assert.instanceOf(channel, VoiceaChannel);
58
+ });
59
+
60
+ it('creates a new VoiceaChannel instance with undefined llmChannel', () => {
61
+ const channel = plugin.createChannel(undefined);
62
+
63
+ assert.instanceOf(channel, VoiceaChannel);
64
+ });
65
+
66
+ it('creates independent channels for multiple calls', () => {
67
+ const mockLLMChannel1 = createMockLLMChannel();
68
+ const mockLLMChannel2 = createMockLLMChannel();
69
+
70
+ const channel1 = plugin.createChannel(mockLLMChannel1);
71
+ const channel2 = plugin.createChannel(mockLLMChannel2);
72
+
73
+ assert.notStrictEqual(channel1, channel2);
74
+ });
75
+ });
76
+
77
+ describe('namespace', () => {
78
+ it('has the correct namespace', () => {
79
+ assert.equal(plugin.namespace, 'voicea');
80
+ });
81
+ });
82
+ });
83
+ });