@webex/internal-plugin-board 3.0.0-beta.8 → 3.0.0-bnr.0

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.
@@ -18,66 +18,90 @@ describe('plugin-board', () => {
18
18
  let mccoy, spock;
19
19
  let mccoyRealtimeChannel, spockRealtimeChannel;
20
20
 
21
- before('create users', () => testUsers.create({count: 2})
22
- .then(async (users) => {
21
+ before('create users', () =>
22
+ testUsers.create({count: 2}).then(async (users) => {
23
23
  participants = [spock, mccoy] = users;
24
24
 
25
25
  // Pause for 5 seconds for CI
26
26
  await new Promise((done) => setTimeout(done, 5000));
27
27
 
28
- return Promise.all(map(participants, (participant) => {
29
- participant.webex = new WebexCore({
30
- credentials: {
31
- authorization: participant.token
32
- },
33
- // NOTE: temp fix so that realtime tests pass
34
- // Test user catalogue does not include the URL from utc
35
- config: {
36
- services: {
37
- override: {
38
- 'mercury-test': 'wss://mercury-connection-llm.intb1.ciscospark.com/'
39
- }
40
- }
41
- }
42
- });
43
-
44
- return participant.webex.internal.device.register();
45
- }));
46
- }));
47
-
48
- before('create conversation', () => spock.webex.internal.conversation.create({
49
- displayName: 'Test Board Conversation',
50
- participants
51
- })
52
- .then((c) => {
53
- conversation = c;
54
-
55
- return conversation;
56
- }));
28
+ return Promise.all(
29
+ map(participants, (participant) => {
30
+ participant.webex = new WebexCore({
31
+ credentials: {
32
+ authorization: participant.token,
33
+ },
34
+ // NOTE: temp fix so that realtime tests pass
35
+ // Test user catalogue does not include the URL from utc
36
+ config: {
37
+ services: {
38
+ override: {
39
+ 'mercury-test': 'wss://mercury-connection-llm.intb1.ciscospark.com/',
40
+ },
41
+ },
42
+ },
43
+ });
57
44
 
58
- before('create channel (board)', () => spock.webex.internal.board.createChannel(conversation)
59
- .then((channel) => {
45
+ return participant.webex.internal.device.register();
46
+ })
47
+ );
48
+ })
49
+ );
50
+
51
+ before('create conversation', () =>
52
+ spock.webex.internal.conversation
53
+ .create({
54
+ displayName: 'Test Board Conversation',
55
+ participants,
56
+ })
57
+ .then((c) => {
58
+ conversation = c;
59
+
60
+ return conversation;
61
+ })
62
+ );
63
+
64
+ before('create channel (board)', () =>
65
+ spock.webex.internal.board.createChannel(conversation).then((channel) => {
60
66
  board = channel;
61
67
 
62
68
  return channel;
63
- }));
69
+ })
70
+ );
64
71
 
65
- before('connect to realtime channel', () => Promise.all(map(participants, (participant) => participant.webex.internal.board.realtime.connectByOpenNewMercuryConnection(board))));
72
+ before('connect to realtime channel', () =>
73
+ Promise.all(
74
+ map(participants, (participant) =>
75
+ participant.webex.internal.board.realtime.connectByOpenNewMercuryConnection(board)
76
+ )
77
+ )
78
+ );
66
79
 
67
80
  before('get realtime channels', () => {
68
- spockRealtimeChannel = spock.webex.internal.board.realtime.realtimeChannels.get(board.channelId);
69
- mccoyRealtimeChannel = mccoy.webex.internal.board.realtime.realtimeChannels.get(board.channelId);
81
+ spockRealtimeChannel = spock.webex.internal.board.realtime.realtimeChannels.get(
82
+ board.channelId
83
+ );
84
+ mccoyRealtimeChannel = mccoy.webex.internal.board.realtime.realtimeChannels.get(
85
+ board.channelId
86
+ );
70
87
  });
71
88
 
72
- before('load fixture image', () => fh.fetch('sample-image-small-one.png')
73
- .then((fetchedFixture) => {
89
+ before('load fixture image', () =>
90
+ fh.fetch('sample-image-small-one.png').then((fetchedFixture) => {
74
91
  fixture = fetchedFixture;
75
92
 
76
93
  return fetchedFixture;
77
- }));
94
+ })
95
+ );
78
96
 
79
97
  // disconnect realtime
80
- after('disconnect realtime channel', () => Promise.all(map(participants, (participant) => participant.webex.internal.board.realtime.disconnectMercuryConnection(board))));
98
+ after('disconnect realtime channel', () =>
99
+ Promise.all(
100
+ map(participants, (participant) =>
101
+ participant.webex.internal.board.realtime.disconnectMercuryConnection(board)
102
+ )
103
+ )
104
+ );
81
105
 
82
106
  describe('#config', () => {
83
107
  it('shares board values', () => {
@@ -104,11 +128,11 @@ describe('plugin-board', () => {
104
128
  const data = {
105
129
  envelope: {
106
130
  channelId: board,
107
- roomId: conversation.id
131
+ roomId: conversation.id,
108
132
  },
109
133
  payload: {
110
- msg: uniqueRealtimeData
111
- }
134
+ msg: uniqueRealtimeData,
135
+ },
112
136
  };
113
137
 
114
138
  // confirm that both are connected.
@@ -117,19 +141,20 @@ describe('plugin-board', () => {
117
141
 
118
142
  spock.webex.internal.board.realtime.publish(board, data);
119
143
 
120
- return maxWaitForEvent(5000, 'event:board.activity', mccoyRealtimeChannel)
121
- .then((event) => {
144
+ return maxWaitForEvent(5000, 'event:board.activity', mccoyRealtimeChannel).then(
145
+ (event) => {
122
146
  assert.equal(event.data.contentType, 'STRING');
123
147
  assert.equal(event.data.payload.msg, uniqueRealtimeData);
124
- });
148
+ }
149
+ );
125
150
  });
126
151
  });
127
152
 
128
153
  describe('file payload', () => {
129
154
  let testScr;
130
155
 
131
- it('uploads file to webex files which includes loc', () => mccoy.webex.internal.board._uploadImage(board, fixture)
132
- .then((scr) => {
156
+ it('uploads file to webex files which includes loc', () =>
157
+ mccoy.webex.internal.board._uploadImage(board, fixture).then((scr) => {
133
158
  assert.property(scr, 'loc');
134
159
  testScr = scr;
135
160
  }));
@@ -138,15 +163,15 @@ describe('plugin-board', () => {
138
163
  const data = {
139
164
  envelope: {
140
165
  channelId: board,
141
- roomId: conversation.id
166
+ roomId: conversation.id,
142
167
  },
143
168
  payload: {
144
169
  displayName: 'image.png',
145
170
  type: 'FILE',
146
171
  file: {
147
- scr: testScr
148
- }
149
- }
172
+ scr: testScr,
173
+ },
174
+ },
150
175
  };
151
176
 
152
177
  // confirm that both are listening.
@@ -155,12 +180,13 @@ describe('plugin-board', () => {
155
180
 
156
181
  spock.webex.internal.board.realtime.publish(board, data);
157
182
 
158
- return maxWaitForEvent(5000, 'event:board.activity', mccoyRealtimeChannel)
159
- .then((event) => {
183
+ return maxWaitForEvent(5000, 'event:board.activity', mccoyRealtimeChannel).then(
184
+ (event) => {
160
185
  assert.equal(event.data.contentType, 'FILE');
161
186
  assert.equal(event.data.payload.file.scr.loc, testScr.loc);
162
187
  assert.equal(event.data.payload.displayName, 'image.png');
163
- });
188
+ }
189
+ );
164
190
  });
165
191
  });
166
192
  });
@@ -17,93 +17,133 @@ describe.skip('plugin-board', () => {
17
17
  let mccoy, spock;
18
18
  let uniqueRealtimeData;
19
19
 
20
- before('create users', () => testUsers.create({count: 2})
21
- .then((users) => {
20
+ before('create users', () =>
21
+ testUsers.create({count: 2}).then((users) => {
22
22
  participants = [spock, mccoy] = users;
23
23
 
24
- return Promise.all(participants.map((participant) => {
25
- participant.webex = new WebexCore({
26
- credentials: {
27
- authorization: participant.token
28
- }
29
- });
30
-
31
- return participant.webex.internal.device.register()
32
- .then(() => participant.webex.internal.feature.setFeature('developer', 'web-shared-mercury', true));
33
- }));
34
- }));
35
-
36
- before('create conversation', () => spock.webex.internal.conversation.create({
37
- displayName: 'Test Board Mercury',
38
- participants
39
- })
40
- .then((c) => {
41
- conversation = c;
42
-
43
- return conversation;
44
- }));
24
+ return Promise.all(
25
+ participants.map((participant) => {
26
+ participant.webex = new WebexCore({
27
+ credentials: {
28
+ authorization: participant.token,
29
+ },
30
+ });
45
31
 
46
- before('create channel (board)', () => spock.webex.internal.board.createChannel(conversation)
47
- .then((channel) => {
32
+ return participant.webex.internal.device
33
+ .register()
34
+ .then(() =>
35
+ participant.webex.internal.feature.setFeature(
36
+ 'developer',
37
+ 'web-shared-mercury',
38
+ true
39
+ )
40
+ );
41
+ })
42
+ );
43
+ })
44
+ );
45
+
46
+ before('create conversation', () =>
47
+ spock.webex.internal.conversation
48
+ .create({
49
+ displayName: 'Test Board Mercury',
50
+ participants,
51
+ })
52
+ .then((c) => {
53
+ conversation = c;
54
+
55
+ return conversation;
56
+ })
57
+ );
58
+
59
+ before('create channel (board)', () =>
60
+ spock.webex.internal.board.createChannel(conversation).then((channel) => {
48
61
  board = channel;
49
62
 
50
63
  return channel;
51
- }));
64
+ })
65
+ );
52
66
 
53
- before('create second channel (board)', () => mccoy.webex.internal.board.createChannel(conversation)
54
- .then((channel) => {
67
+ before('create second channel (board)', () =>
68
+ mccoy.webex.internal.board.createChannel(conversation).then((channel) => {
55
69
  secondBoard = channel;
56
70
 
57
71
  return channel;
58
- }));
72
+ })
73
+ );
59
74
 
60
- beforeEach('connect to mercury channel', () => Promise.all(participants.map((participant) => participant.webex.internal.mercury.connect())));
75
+ beforeEach('connect to mercury channel', () =>
76
+ Promise.all(participants.map((participant) => participant.webex.internal.mercury.connect()))
77
+ );
61
78
 
62
- afterEach('disconnect mercury', () => Promise.all(participants.map((participant) => participant.webex.internal.mercury.disconnect())));
79
+ afterEach('disconnect mercury', () =>
80
+ Promise.all(
81
+ participants.map((participant) => participant.webex.internal.mercury.disconnect())
82
+ )
83
+ );
63
84
 
64
85
  describe('#publish()', () => {
65
86
  describe('string payload', () => {
66
87
  let spockRealtimeChannel;
67
88
  let mccoyRealtimeChannel;
68
89
 
69
- before('open two connections', () => Promise.all([
70
- spock.webex.internal.board.realtime.connectToSharedMercury(board),
71
- mccoy.webex.internal.board.realtime.connectByOpenNewMercuryConnection(board)
72
- ]));
90
+ before('open two connections', () =>
91
+ Promise.all([
92
+ spock.webex.internal.board.realtime.connectToSharedMercury(board),
93
+ mccoy.webex.internal.board.realtime.connectByOpenNewMercuryConnection(board),
94
+ ])
95
+ );
73
96
 
74
97
  before('get realtime channels', () => {
75
- spockRealtimeChannel = spock.webex.internal.board.realtime.realtimeChannels.get(board.channelId);
76
- mccoyRealtimeChannel = mccoy.webex.internal.board.realtime.realtimeChannels.get(board.channelId);
98
+ spockRealtimeChannel = spock.webex.internal.board.realtime.realtimeChannels.get(
99
+ board.channelId
100
+ );
101
+ mccoyRealtimeChannel = mccoy.webex.internal.board.realtime.realtimeChannels.get(
102
+ board.channelId
103
+ );
77
104
  });
78
105
 
79
- after(() => Promise.all(participants.map((participant) => participant.webex.internal.board.realtime.disconnectFromSharedMercury(board))));
106
+ after(() =>
107
+ Promise.all(
108
+ participants.map((participant) =>
109
+ participant.webex.internal.board.realtime.disconnectFromSharedMercury(board)
110
+ )
111
+ )
112
+ );
80
113
 
81
114
  it('posts a message from shared connection to the specified board', () => {
82
115
  uniqueRealtimeData = uuid.v4();
83
116
  const data = {
84
117
  envelope: {
85
118
  channelId: board,
86
- roomId: conversation.id
119
+ roomId: conversation.id,
87
120
  },
88
121
  payload: {
89
- msg: uniqueRealtimeData
90
- }
122
+ msg: uniqueRealtimeData,
123
+ },
91
124
  };
92
125
 
93
126
  // confirm that both are connected.
94
- assert.isTrue(spockRealtimeChannel.isSharingMercury, 'spock is sharing mercury connection');
127
+ assert.isTrue(
128
+ spockRealtimeChannel.isSharingMercury,
129
+ 'spock is sharing mercury connection'
130
+ );
95
131
  assert.isTrue(spock.webex.internal.mercury.connected, 'spock is connected');
96
- assert.isFalse(mccoyRealtimeChannel.isSharingMercury, 'mccoy should not share mercury connection');
132
+ assert.isFalse(
133
+ mccoyRealtimeChannel.isSharingMercury,
134
+ 'mccoy should not share mercury connection'
135
+ );
97
136
  assert.isTrue(mccoy.webex.internal.mercury.connected, 'mccoy is connected');
98
137
 
99
138
  spock.webex.internal.board.realtime.publish(board, data);
100
139
 
101
140
  // mccoy listens and verifies data received
102
- return maxWaitForEvent(5000, 'event:board.activity', mccoyRealtimeChannel)
103
- .then(({data}) => {
141
+ return maxWaitForEvent(5000, 'event:board.activity', mccoyRealtimeChannel).then(
142
+ ({data}) => {
104
143
  assert.equal(data.contentType, 'STRING');
105
144
  assert.equal(data.payload.msg, uniqueRealtimeData);
106
- });
145
+ }
146
+ );
107
147
  });
108
148
 
109
149
  it('posts a message from separated socket connection to the specified board', () => {
@@ -111,25 +151,32 @@ describe.skip('plugin-board', () => {
111
151
  const data = {
112
152
  envelope: {
113
153
  channelId: board,
114
- roomId: conversation.id
154
+ roomId: conversation.id,
115
155
  },
116
156
  payload: {
117
- msg: uniqueRealtimeData
118
- }
157
+ msg: uniqueRealtimeData,
158
+ },
119
159
  };
120
160
 
121
161
  assert.isTrue(spock.webex.internal.mercury.connected, 'spock is connected');
122
- assert.isTrue(spockRealtimeChannel.isSharingMercury, 'spock is sharing mercury connection');
162
+ assert.isTrue(
163
+ spockRealtimeChannel.isSharingMercury,
164
+ 'spock is sharing mercury connection'
165
+ );
123
166
  assert.isTrue(mccoy.webex.internal.mercury.connected, 'mccoy is connected');
124
- assert.isFalse(mccoyRealtimeChannel.isSharingMercury, 'mccoy does not share mercury connection');
167
+ assert.isFalse(
168
+ mccoyRealtimeChannel.isSharingMercury,
169
+ 'mccoy does not share mercury connection'
170
+ );
125
171
 
126
172
  mccoy.webex.internal.board.realtime.publish(board, data);
127
173
 
128
- return maxWaitForEvent(5000, 'event:board.activity', spockRealtimeChannel)
129
- .then(({data}) => {
174
+ return maxWaitForEvent(5000, 'event:board.activity', spockRealtimeChannel).then(
175
+ ({data}) => {
130
176
  assert.equal(data.contentType, 'STRING');
131
177
  assert.equal(data.payload.msg, uniqueRealtimeData);
132
- });
178
+ }
179
+ );
133
180
  });
134
181
  });
135
182
  });
@@ -139,46 +186,77 @@ describe.skip('plugin-board', () => {
139
186
  uniqueRealtimeData = uuid.v4();
140
187
 
141
188
  return promiseSeries([
142
- spock.webex.internal.board.realtime.connectToSharedMercury.bind(spock.webex.internal.board.realtime, board),
143
- mccoy.webex.internal.board.realtime.connectToSharedMercury.bind(mccoy.webex.internal.board.realtime, board),
144
- spock.webex.internal.board.realtime.connectToSharedMercury.bind(spock.webex.internal.board.realtime, secondBoard),
145
- mccoy.webex.internal.board.realtime.connectToSharedMercury.bind(mccoy.webex.internal.board.realtime, secondBoard)
189
+ spock.webex.internal.board.realtime.connectToSharedMercury.bind(
190
+ spock.webex.internal.board.realtime,
191
+ board
192
+ ),
193
+ mccoy.webex.internal.board.realtime.connectToSharedMercury.bind(
194
+ mccoy.webex.internal.board.realtime,
195
+ board
196
+ ),
197
+ spock.webex.internal.board.realtime.connectToSharedMercury.bind(
198
+ spock.webex.internal.board.realtime,
199
+ secondBoard
200
+ ),
201
+ mccoy.webex.internal.board.realtime.connectToSharedMercury.bind(
202
+ mccoy.webex.internal.board.realtime,
203
+ secondBoard
204
+ ),
146
205
  ]);
147
206
  });
148
207
 
149
- afterEach(() => Promise.all(participants.map((participant) => promiseSeries([
150
- participant.webex.internal.board.realtime.disconnectFromSharedMercury.bind(participant.webex.internal.board.realtime, board),
151
- participant.webex.internal.board.realtime.disconnectFromSharedMercury.bind(participant.webex.internal.board.realtime, secondBoard)
152
- ]))));
208
+ afterEach(() =>
209
+ Promise.all(
210
+ participants.map((participant) =>
211
+ promiseSeries([
212
+ participant.webex.internal.board.realtime.disconnectFromSharedMercury.bind(
213
+ participant.webex.internal.board.realtime,
214
+ board
215
+ ),
216
+ participant.webex.internal.board.realtime.disconnectFromSharedMercury.bind(
217
+ participant.webex.internal.board.realtime,
218
+ secondBoard
219
+ ),
220
+ ])
221
+ )
222
+ )
223
+ );
153
224
 
154
225
  it('receives correct message for the corresponding board', (done) => {
155
226
  const data1 = {
156
227
  envelope: {
157
228
  channelId: board,
158
- roomId: conversation.id
229
+ roomId: conversation.id,
159
230
  },
160
231
  payload: {
161
- msg: `first message for ${board.channelId} ${uniqueRealtimeData}`
162
- }
232
+ msg: `first message for ${board.channelId} ${uniqueRealtimeData}`,
233
+ },
163
234
  };
164
235
  const data2 = {
165
236
  envelope: {
166
237
  channelId: secondBoard,
167
- roomId: conversation.id
238
+ roomId: conversation.id,
168
239
  },
169
240
  payload: {
170
- msg: `second message for ${secondBoard.channelId} ${uniqueRealtimeData}`
171
- }
241
+ msg: `second message for ${secondBoard.channelId} ${uniqueRealtimeData}`,
242
+ },
172
243
  };
173
244
 
174
245
  let receivedFirstMsg = false;
175
246
  let receivedSecondMsg = false;
176
- const mccoyRealtimeChannel0 = mccoy.webex.internal.board.realtime.realtimeChannels.get(board.channelId);
177
- const mccoyRealtimeChannel1 = mccoy.webex.internal.board.realtime.realtimeChannels.get(secondBoard.channelId);
247
+ const mccoyRealtimeChannel0 = mccoy.webex.internal.board.realtime.realtimeChannels.get(
248
+ board.channelId
249
+ );
250
+ const mccoyRealtimeChannel1 = mccoy.webex.internal.board.realtime.realtimeChannels.get(
251
+ secondBoard.channelId
252
+ );
178
253
 
179
254
  mccoyRealtimeChannel0.once('event:board.activity', ({data}) => {
180
255
  assert.equal(data.contentType, 'STRING');
181
- assert.equal(data.payload.msg, `first message for ${board.channelId} ${uniqueRealtimeData}`);
256
+ assert.equal(
257
+ data.payload.msg,
258
+ `first message for ${board.channelId} ${uniqueRealtimeData}`
259
+ );
182
260
  receivedFirstMsg = true;
183
261
  if (receivedFirstMsg && receivedSecondMsg) {
184
262
  done();
@@ -187,7 +265,10 @@ describe.skip('plugin-board', () => {
187
265
 
188
266
  mccoyRealtimeChannel1.once('event:board.activity', ({data}) => {
189
267
  assert.equal(data.contentType, 'STRING');
190
- assert.equal(data.payload.msg, `second message for ${secondBoard.channelId} ${uniqueRealtimeData}`);
268
+ assert.equal(
269
+ data.payload.msg,
270
+ `second message for ${secondBoard.channelId} ${uniqueRealtimeData}`
271
+ );
191
272
  receivedSecondMsg = true;
192
273
  if (receivedFirstMsg && receivedSecondMsg) {
193
274
  done();
@@ -196,7 +277,7 @@ describe.skip('plugin-board', () => {
196
277
 
197
278
  Promise.all([
198
279
  spock.webex.internal.board.realtime.publish(board, data1),
199
- spock.webex.internal.board.realtime.publish(secondBoard, data2)
280
+ spock.webex.internal.board.realtime.publish(secondBoard, data2),
200
281
  ]);
201
282
  });
202
283
  });