@webex/internal-plugin-conversation 3.0.0-beta.14 → 3.0.0-beta.140
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.
- package/README.md +1 -3
- package/dist/activities.js +8 -69
- package/dist/activities.js.map +1 -1
- package/dist/activity-thread-ordering.js +19 -79
- package/dist/activity-thread-ordering.js.map +1 -1
- package/dist/config.js +1 -7
- package/dist/config.js.map +1 -1
- package/dist/constants.js +4 -5
- package/dist/constants.js.map +1 -1
- package/dist/conversation.js +790 -1199
- package/dist/conversation.js.map +1 -1
- package/dist/convo-error.js +0 -23
- package/dist/convo-error.js.map +1 -1
- package/dist/decryption-transforms.js +35 -98
- package/dist/decryption-transforms.js.map +1 -1
- package/dist/encryption-transforms.js +11 -48
- package/dist/encryption-transforms.js.map +1 -1
- package/dist/index.js +7 -50
- package/dist/index.js.map +1 -1
- package/dist/share-activity.js +40 -106
- package/dist/share-activity.js.map +1 -1
- package/dist/to-array.js +9 -11
- package/dist/to-array.js.map +1 -1
- package/package.json +15 -15
- package/src/activities.js +10 -7
- package/src/activity-thread-ordering.js +27 -30
- package/src/activity-threading.md +68 -49
- package/src/config.js +5 -5
- package/src/conversation.js +621 -589
- package/src/decryption-transforms.js +103 -62
- package/src/encryption-transforms.js +103 -83
- package/src/index.js +82 -66
- package/src/share-activity.js +64 -55
- package/src/to-array.js +2 -2
- package/test/integration/spec/create.js +186 -121
- package/test/integration/spec/encryption.js +249 -186
- package/test/integration/spec/get.js +763 -514
- package/test/integration/spec/mercury.js +37 -27
- package/test/integration/spec/share.js +292 -229
- package/test/integration/spec/verbs.js +628 -441
- package/test/unit/spec/conversation.js +265 -163
- package/test/unit/spec/decrypt-transforms.js +112 -131
- package/test/unit/spec/encryption-transforms.js +24 -18
- package/test/unit/spec/share-activity.js +37 -40
|
@@ -26,24 +26,23 @@ describe('plugin-conversation', function () {
|
|
|
26
26
|
|
|
27
27
|
webex = new WebexCore({
|
|
28
28
|
credentials: {
|
|
29
|
-
authorization: spock.token
|
|
30
|
-
}
|
|
29
|
+
authorization: spock.token,
|
|
30
|
+
},
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
webex.config.conversation.allowedOutboundTags = {
|
|
34
|
-
strong: []
|
|
34
|
+
strong: [],
|
|
35
35
|
};
|
|
36
36
|
webex.config.conversation.allowedInboundTags = {
|
|
37
|
-
strong: []
|
|
37
|
+
strong: [],
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
mccoy.webex = new WebexCore({
|
|
41
41
|
credentials: {
|
|
42
|
-
authorization: mccoy.token
|
|
43
|
-
}
|
|
42
|
+
authorization: mccoy.token,
|
|
43
|
+
},
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
// eslint-disable-next-line no-unused-expressions
|
|
47
46
|
await webex.internal.mercury.connect();
|
|
48
47
|
await mccoy.webex.internal.mercury.connect();
|
|
49
48
|
|
|
@@ -51,10 +50,10 @@ describe('plugin-conversation', function () {
|
|
|
51
50
|
});
|
|
52
51
|
|
|
53
52
|
after(async () => {
|
|
54
|
-
// eslint-disable-next-line no-unused-expressions
|
|
55
|
-
webex && await webex.internal.mercury.disconnect();
|
|
56
|
-
// eslint-disable-next-line no-unused-expressions
|
|
57
|
-
mccoy && await mccoy.webex.internal.mercury.disconnect();
|
|
53
|
+
// eslint-disable-next-line chai-friendly/no-unused-expressions
|
|
54
|
+
webex && (await webex.internal.mercury.disconnect());
|
|
55
|
+
// eslint-disable-next-line chai-friendly/no-unused-expressions
|
|
56
|
+
mccoy && (await mccoy.webex.internal.mercury.disconnect());
|
|
58
57
|
});
|
|
59
58
|
|
|
60
59
|
function makeEmailAddress() {
|
|
@@ -62,8 +61,8 @@ describe('plugin-conversation', function () {
|
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
describe('when there is only one other participant', () => {
|
|
65
|
-
it('creates a 1:1 conversation', () =>
|
|
66
|
-
.then((conversation) => {
|
|
64
|
+
it('creates a 1:1 conversation', () =>
|
|
65
|
+
webex.internal.conversation.create({participants: [mccoy]}).then((conversation) => {
|
|
67
66
|
assert.isConversation(conversation);
|
|
68
67
|
assert.isOneOnOneConversation(conversation);
|
|
69
68
|
assert.isNewEncryptedConversation(conversation);
|
|
@@ -73,13 +72,15 @@ describe('plugin-conversation', function () {
|
|
|
73
72
|
}));
|
|
74
73
|
|
|
75
74
|
// TODO: Issues with side boarding users too soon. Skipping until it's fixed
|
|
76
|
-
describe.skip(
|
|
75
|
+
describe.skip("when the other user doesn't exist", () => {
|
|
77
76
|
let email;
|
|
78
77
|
|
|
79
|
-
beforeEach(() => {
|
|
78
|
+
beforeEach(() => {
|
|
79
|
+
email = makeEmailAddress();
|
|
80
|
+
});
|
|
80
81
|
|
|
81
|
-
it('invites the other user', () =>
|
|
82
|
-
.then((conversation) => {
|
|
82
|
+
it('invites the other user', () =>
|
|
83
|
+
webex.internal.conversation.create({participants: [email]}).then((conversation) => {
|
|
83
84
|
assert.isConversation(conversation);
|
|
84
85
|
assert.isOneOnOneConversation(conversation);
|
|
85
86
|
assert.isNewEncryptedConversation(conversation);
|
|
@@ -93,132 +94,196 @@ describe('plugin-conversation', function () {
|
|
|
93
94
|
|
|
94
95
|
describe('when the conversation already exists', () => {
|
|
95
96
|
describe('with skipOneOnOneFetch=true', () => {
|
|
96
|
-
it('fails to create a 1:1 conversation that already exists', () =>
|
|
97
|
-
|
|
97
|
+
it('fails to create a 1:1 conversation that already exists', () =>
|
|
98
|
+
assert
|
|
99
|
+
.isRejected(
|
|
100
|
+
webex.internal.conversation.create(
|
|
101
|
+
{participants: [mccoy]},
|
|
102
|
+
{skipOneOnOneFetch: true}
|
|
103
|
+
)
|
|
104
|
+
)
|
|
105
|
+
.then((reason) => assert.instanceOf(reason, WebexHttpError.Conflict)));
|
|
98
106
|
});
|
|
99
107
|
|
|
100
|
-
it('returns the preexisting conversation', () =>
|
|
101
|
-
|
|
102
|
-
.then((conversation2) => {
|
|
108
|
+
it('returns the preexisting conversation', () =>
|
|
109
|
+
webex.internal.conversation.create({participants: [checkov]}).then((conversation) =>
|
|
110
|
+
webex.internal.conversation.create({participants: [checkov]}).then((conversation2) => {
|
|
103
111
|
assert.equal(conversation2.url, conversation.url);
|
|
104
112
|
assert.lengthOf(conversation.activities.items, 1);
|
|
105
113
|
assert.equal(conversation.activities.items[0].verb, 'create');
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
114
|
+
})
|
|
115
|
+
));
|
|
116
|
+
|
|
117
|
+
it('returns the preexisting conversation and posts a comment', () =>
|
|
118
|
+
webex.internal.conversation
|
|
119
|
+
.create({participants: [checkov], comment: 'hi'})
|
|
120
|
+
.then((conversation) =>
|
|
121
|
+
webex.internal.conversation
|
|
122
|
+
.create({participants: [checkov]})
|
|
123
|
+
.then((conversation2) => {
|
|
124
|
+
assert.equal(conversation2.id, conversation.id);
|
|
125
|
+
// the first activity is "create"; get the "post"
|
|
126
|
+
const activity = conversation.activities.items.pop();
|
|
127
|
+
|
|
128
|
+
assert.equal(activity.verb, 'post');
|
|
129
|
+
assert.equal(activity.object.displayName, 'hi');
|
|
130
|
+
})
|
|
131
|
+
));
|
|
132
|
+
|
|
133
|
+
it('returns the preexisting conversation and posts a comment with html', () =>
|
|
134
|
+
webex.internal.conversation
|
|
135
|
+
.create({participants: [checkov], comment: '**hi**', html: '<strong>hi</strong>'})
|
|
136
|
+
.then((conversation) =>
|
|
137
|
+
webex.internal.conversation
|
|
138
|
+
.create({participants: [checkov]})
|
|
139
|
+
.then((conversation2) => {
|
|
140
|
+
assert.equal(conversation2.id, conversation.id);
|
|
141
|
+
// the first activity is "create"; get the "post"
|
|
142
|
+
const activity = conversation.activities.items.pop();
|
|
143
|
+
|
|
144
|
+
assert.equal(activity.verb, 'post');
|
|
145
|
+
assert.equal(activity.object.displayName, '**hi**');
|
|
146
|
+
assert.equal(activity.object.content, '<strong>hi</strong>');
|
|
147
|
+
})
|
|
148
|
+
));
|
|
130
149
|
});
|
|
131
150
|
|
|
132
151
|
describe('when {forceGrouped: true} is specified', () => {
|
|
133
|
-
it('creates a grouped conversation @canary', () =>
|
|
134
|
-
.
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
152
|
+
it('creates a grouped conversation @canary', () =>
|
|
153
|
+
webex.internal.conversation
|
|
154
|
+
.create({participants: [mccoy]}, {forceGrouped: true})
|
|
155
|
+
.then((conversation) => {
|
|
156
|
+
assert.isConversation(conversation);
|
|
157
|
+
assert.isGroupConversation(conversation);
|
|
158
|
+
assert.isNewEncryptedConversation(conversation);
|
|
159
|
+
|
|
160
|
+
assert.lengthOf(conversation.participants.items, 2);
|
|
161
|
+
assert.lengthOf(conversation.activities.items, 1);
|
|
162
|
+
}));
|
|
142
163
|
});
|
|
143
164
|
});
|
|
144
165
|
|
|
145
166
|
describe('when there is an invalid user in the participants list', () => {
|
|
146
167
|
describe('with allowPartialCreation', () => {
|
|
147
|
-
it('creates a group conversation', () =>
|
|
148
|
-
.
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
it('creates a group conversation', () =>
|
|
169
|
+
webex.internal.conversation
|
|
170
|
+
.create({participants: [mccoy, 'invalidUser']}, {allowPartialCreation: true})
|
|
171
|
+
.then((conversation) => {
|
|
172
|
+
assert.isConversation(conversation);
|
|
173
|
+
assert.isGroupConversation(conversation);
|
|
174
|
+
assert.isNewEncryptedConversation(conversation);
|
|
175
|
+
|
|
176
|
+
assert.lengthOf(conversation.participants.items, 2);
|
|
177
|
+
assert.lengthOf(conversation.activities.items, 1);
|
|
178
|
+
}));
|
|
179
|
+
|
|
180
|
+
it('creates a group conversation with invalid uuid', () =>
|
|
181
|
+
testUsers
|
|
182
|
+
.remove([kirk])
|
|
183
|
+
.then(() =>
|
|
184
|
+
webex.internal.conversation.create(
|
|
185
|
+
{participants: [mccoy.id, kirk.id]},
|
|
186
|
+
{allowPartialCreation: true}
|
|
187
|
+
)
|
|
188
|
+
)
|
|
189
|
+
.then((conversation) => {
|
|
190
|
+
assert.isConversation(conversation);
|
|
191
|
+
assert.isGroupConversation(conversation);
|
|
192
|
+
assert.isNewEncryptedConversation(conversation);
|
|
193
|
+
|
|
194
|
+
assert.lengthOf(conversation.participants.items, 2);
|
|
195
|
+
assert.lengthOf(conversation.activities.items, 1);
|
|
196
|
+
}));
|
|
197
|
+
|
|
198
|
+
it('fails to create a 1:1 conversation', () =>
|
|
199
|
+
assert
|
|
200
|
+
.isRejected(
|
|
201
|
+
webex.internal.conversation.create(
|
|
202
|
+
{participants: ['invalidUser']},
|
|
203
|
+
{allowPartialCreation: true}
|
|
204
|
+
)
|
|
205
|
+
)
|
|
206
|
+
.then((reason) => assert.instanceOf(reason, InvalidUserCreation)));
|
|
170
207
|
});
|
|
171
208
|
|
|
172
209
|
describe('without allowPartialCreation', () => {
|
|
173
|
-
it('fails to create a group conversation without allowPartialCreation param', () =>
|
|
210
|
+
it('fails to create a group conversation without allowPartialCreation param', () =>
|
|
211
|
+
assert.isRejected(
|
|
212
|
+
webex.internal.conversation.create({participants: [mccoy, 'invalidUser']})
|
|
213
|
+
));
|
|
174
214
|
});
|
|
175
215
|
});
|
|
176
216
|
|
|
177
217
|
describe('when {compact: ?} is not specified', () => {
|
|
178
|
-
it('creates a compact conversation', () =>
|
|
179
|
-
|
|
180
|
-
|
|
218
|
+
it('creates a compact conversation', () =>
|
|
219
|
+
webex.internal.conversation
|
|
220
|
+
.create({participants})
|
|
221
|
+
.then((c) => webex.internal.conversation.get(c, {activitiesLimit: 5}))
|
|
222
|
+
.then((c) => assert.lengthOf(c.activities.items, 1)));
|
|
181
223
|
});
|
|
182
224
|
|
|
183
|
-
it('creates a conversation with a name', () =>
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
it('creates a
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
.
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
it('ensures the current user is in the participants list', () => webex.internal.conversation.create({comment: 'comment', participants: [mccoy, checkov]})
|
|
216
|
-
.then((c) => webex.internal.conversation.get(c, {includeParticipants: true}))
|
|
217
|
-
.then((c) => assert.include(map(c.participants.items, 'id'), spock.id)));
|
|
218
|
-
|
|
219
|
-
it('does not allow me to create a conversation with zero participants', () => assert.isRejected(webex.internal.conversation.create({participants: []}, /`params.participants` is required/)));
|
|
225
|
+
it('creates a conversation with a name', () =>
|
|
226
|
+
webex.internal.conversation
|
|
227
|
+
.create({displayName: 'displayName', participants})
|
|
228
|
+
.then((c) => webex.internal.conversation.get(c))
|
|
229
|
+
.then((c) => assert.equal(c.displayName, 'displayName')));
|
|
230
|
+
|
|
231
|
+
it('creates a conversation with a comment', () =>
|
|
232
|
+
webex.internal.conversation
|
|
233
|
+
.create({comment: 'comment', participants})
|
|
234
|
+
.then((c) => webex.internal.conversation.get(c, {activitiesLimit: 2}))
|
|
235
|
+
.then((c) => assert.equal(c.activities.items[1].object.displayName, 'comment')));
|
|
236
|
+
|
|
237
|
+
it('creates a conversation with a tag', () =>
|
|
238
|
+
webex.internal.conversation
|
|
239
|
+
.create({tags: ['WELCOME'], participants})
|
|
240
|
+
.then((c) => webex.internal.conversation.get(c, {activitiesLimit: 1}))
|
|
241
|
+
.then((c) => assert.equal(c.tags[0], 'WELCOME')));
|
|
242
|
+
|
|
243
|
+
it('creates a favorite conversation', () =>
|
|
244
|
+
webex.internal.conversation
|
|
245
|
+
.create({favorite: true, participants})
|
|
246
|
+
.then((c) => webex.internal.conversation.get(c, {activitiesLimit: 1}))
|
|
247
|
+
.then((c) => assert.equal(c.tags[0], 'FAVORITE')));
|
|
248
|
+
|
|
249
|
+
it('creates a conversation with a comment with html', () =>
|
|
250
|
+
webex.internal.conversation
|
|
251
|
+
.create({comment: '**comment**', html: '<strong>comment</strong>', participants})
|
|
252
|
+
.then((c) => webex.internal.conversation.get(c, {activitiesLimit: 2}))
|
|
253
|
+
.then((c) => {
|
|
254
|
+
assert.equal(c.activities.items[1].object.displayName, '**comment**');
|
|
255
|
+
assert.equal(c.activities.items[1].object.content, '<strong>comment</strong>');
|
|
256
|
+
}));
|
|
220
257
|
|
|
221
|
-
it('
|
|
222
|
-
.
|
|
258
|
+
it('creates a conversation with a share', () =>
|
|
259
|
+
webex.internal.conversation
|
|
260
|
+
.create({participants, files: [sampleTextOne]})
|
|
261
|
+
.then((c) => webex.internal.conversation.get(c, {activitiesLimit: 10}))
|
|
262
|
+
.then((c) => {
|
|
263
|
+
assert.equal(last(c.activities.items).verb, 'share');
|
|
264
|
+
|
|
265
|
+
return webex.internal.conversation.download(
|
|
266
|
+
last(c.activities.items).object.files.items[0]
|
|
267
|
+
);
|
|
268
|
+
})
|
|
269
|
+
.then((file) => fh.isMatchingFile(file, sampleTextOne)));
|
|
270
|
+
|
|
271
|
+
it('ensures the current user is in the participants list', () =>
|
|
272
|
+
webex.internal.conversation
|
|
273
|
+
.create({comment: 'comment', participants: [mccoy, checkov]})
|
|
274
|
+
.then((c) => webex.internal.conversation.get(c, {includeParticipants: true}))
|
|
275
|
+
.then((c) => assert.include(map(c.participants.items, 'id'), spock.id)));
|
|
276
|
+
|
|
277
|
+
it('does not allow me to create a conversation with zero participants', () =>
|
|
278
|
+
assert.isRejected(
|
|
279
|
+
webex.internal.conversation.create({participants: []}, /`params.participants` is required/)
|
|
280
|
+
));
|
|
281
|
+
|
|
282
|
+
it('does not allow me to create a classified space when feature toggle is disabled for the org', () =>
|
|
283
|
+
webex.internal.conversation
|
|
284
|
+
.create({participants: [mccoy, checkov], classificationId: 'abcde-12345-Some-UUID'})
|
|
285
|
+
.catch((err) =>
|
|
286
|
+
assert.match(err.toString(), /Org not entitled for space classifications/)
|
|
287
|
+
));
|
|
223
288
|
});
|
|
224
289
|
});
|