@webex/internal-plugin-team 3.0.0-beta.6 → 3.0.0-beta.60
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/config.js +0 -3
- package/dist/config.js.map +1 -1
- package/dist/index.js +4 -23
- package/dist/index.js.map +1 -1
- package/dist/team.js +92 -141
- package/dist/team.js.map +1 -1
- package/package.json +11 -11
- package/src/config.js +1 -1
- package/src/index.js +49 -33
- package/src/team.js +129 -84
- package/test/integration/spec/actions.js +326 -295
- package/test/integration/spec/create.js +81 -51
- package/test/integration/spec/get.js +47 -45
- package/test/integration/spec/mercury.js +53 -43
- package/test/unit/spec/team.js +79 -26
|
@@ -15,42 +15,45 @@ describe('plugin-team', () => {
|
|
|
15
15
|
describe('Team', () => {
|
|
16
16
|
let kirk, spock;
|
|
17
17
|
|
|
18
|
-
before(() =>
|
|
19
|
-
.then((users) => {
|
|
18
|
+
before(() =>
|
|
19
|
+
testUsers.create({count: 2}).then((users) => {
|
|
20
20
|
[kirk, spock] = users;
|
|
21
21
|
|
|
22
22
|
kirk.webex = new WebexCore({
|
|
23
23
|
credentials: {
|
|
24
|
-
authorization: kirk.token
|
|
24
|
+
authorization: kirk.token,
|
|
25
25
|
},
|
|
26
26
|
config: {
|
|
27
27
|
conversation: {
|
|
28
|
-
keepEncryptedProperties: true
|
|
29
|
-
}
|
|
30
|
-
}
|
|
28
|
+
keepEncryptedProperties: true,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
spock.webex = new WebexCore({
|
|
34
34
|
credentials: {
|
|
35
|
-
authorization: spock.token
|
|
35
|
+
authorization: spock.token,
|
|
36
36
|
},
|
|
37
37
|
config: {
|
|
38
38
|
conversation: {
|
|
39
|
-
keepEncryptedProperties: true
|
|
40
|
-
}
|
|
41
|
-
}
|
|
39
|
+
keepEncryptedProperties: true,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
return Promise.all([
|
|
45
45
|
kirk.webex.internal.mercury.connect(),
|
|
46
|
-
spock.webex.internal.mercury.connect()
|
|
46
|
+
spock.webex.internal.mercury.connect(),
|
|
47
47
|
]);
|
|
48
|
-
})
|
|
48
|
+
})
|
|
49
|
+
);
|
|
49
50
|
|
|
50
|
-
after(() =>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
after(() =>
|
|
52
|
+
Promise.all([
|
|
53
|
+
kirk && kirk.webex.internal.mercury.disconnect(),
|
|
54
|
+
spock && spock.webex.internal.mercury.disconnect(),
|
|
55
|
+
])
|
|
56
|
+
);
|
|
54
57
|
|
|
55
58
|
describe('#addConversation()', () => {
|
|
56
59
|
let groupConversation, team;
|
|
@@ -58,179 +61,190 @@ describe('plugin-team', () => {
|
|
|
58
61
|
before(() => {
|
|
59
62
|
const teamPromise = kirk.webex.internal.team.create({
|
|
60
63
|
displayName: `team-${uuid.v4()}`,
|
|
61
|
-
participants: [
|
|
62
|
-
kirk,
|
|
63
|
-
spock
|
|
64
|
-
]
|
|
64
|
+
participants: [kirk, spock],
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
const conversation = {
|
|
68
68
|
displayName: `group-conversation-${uuid.v4()}`,
|
|
69
|
-
participants: [
|
|
70
|
-
kirk
|
|
71
|
-
]
|
|
69
|
+
participants: [kirk],
|
|
72
70
|
};
|
|
73
71
|
|
|
74
72
|
return Promise.all([
|
|
75
73
|
teamPromise,
|
|
76
|
-
kirk.webex.internal.conversation.create(conversation, {forceGrouped: true})
|
|
77
|
-
])
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
});
|
|
74
|
+
kirk.webex.internal.conversation.create(conversation, {forceGrouped: true}),
|
|
75
|
+
]).then(([t, c]) => {
|
|
76
|
+
team = t;
|
|
77
|
+
groupConversation = c;
|
|
78
|
+
});
|
|
82
79
|
});
|
|
83
80
|
|
|
84
|
-
it('adds an existing group conversation to a team', () =>
|
|
85
|
-
.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
})
|
|
93
|
-
.then((t) => {
|
|
94
|
-
assert.equal(t.conversations.items.length, 2);
|
|
95
|
-
const teamConversation = find(t.conversations.items, {id: groupConversation.id});
|
|
96
|
-
const generalConversation = find(t.conversations.items, {id: t.generalConversationUuid});
|
|
97
|
-
|
|
98
|
-
assert.include(teamConversation.tags, 'OPEN');
|
|
99
|
-
|
|
100
|
-
// Ensure that spock can decrypt the title of the room now that
|
|
101
|
-
// it's been added to a team he's a member of.
|
|
102
|
-
assert.equal(generalConversation.displayName, team.displayName);
|
|
103
|
-
assert.equal(teamConversation.displayName, groupConversation.displayName);
|
|
104
|
-
|
|
105
|
-
return kirk.webex.internal.conversation.get(groupConversation);
|
|
106
|
-
})
|
|
107
|
-
.then((conversation) => {
|
|
108
|
-
assert.isDefined(conversation.team);
|
|
109
|
-
assert.equal(conversation.team.id, team.id);
|
|
110
|
-
}));
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
describe('#addMember()', () => {
|
|
114
|
-
let additionalConversation, team;
|
|
115
|
-
|
|
116
|
-
before(() => kirk.webex.internal.team.create({
|
|
117
|
-
displayName: `team-${uuid.v4()}`,
|
|
118
|
-
participants: [
|
|
119
|
-
kirk
|
|
120
|
-
]
|
|
121
|
-
})
|
|
122
|
-
.then((res) => {
|
|
123
|
-
team = res;
|
|
81
|
+
it('adds an existing group conversation to a team', () =>
|
|
82
|
+
kirk.webex.internal.team
|
|
83
|
+
.addConversation(team, groupConversation)
|
|
84
|
+
.then((activity) => {
|
|
85
|
+
assert.isActivity(activity);
|
|
86
|
+
assert.equal(activity.verb, 'add');
|
|
87
|
+
assert.equal(activity.target.id, team.id);
|
|
88
|
+
assert.equal(activity.object.id, groupConversation.id);
|
|
124
89
|
|
|
125
|
-
|
|
126
|
-
displayName: `team-conversation-${uuid.v4()}`,
|
|
127
|
-
participants: [
|
|
128
|
-
kirk
|
|
129
|
-
]
|
|
90
|
+
return spock.webex.internal.team.get(team, {includeTeamConversations: true});
|
|
130
91
|
})
|
|
131
|
-
|
|
132
|
-
|
|
92
|
+
.then((t) => {
|
|
93
|
+
assert.equal(t.conversations.items.length, 2);
|
|
94
|
+
const teamConversation = find(t.conversations.items, {id: groupConversation.id});
|
|
95
|
+
const generalConversation = find(t.conversations.items, {
|
|
96
|
+
id: t.generalConversationUuid,
|
|
133
97
|
});
|
|
134
|
-
}));
|
|
135
98
|
|
|
136
|
-
|
|
137
|
-
.then((activity) => {
|
|
138
|
-
assert.isActivity(activity);
|
|
139
|
-
assert.equal(activity.verb, 'add');
|
|
140
|
-
assert.equal(activity.target.id, team.id);
|
|
141
|
-
assert.equal(activity.object.id, spock.id);
|
|
99
|
+
assert.include(teamConversation.tags, 'OPEN');
|
|
142
100
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
101
|
+
// Ensure that spock can decrypt the title of the room now that
|
|
102
|
+
// it's been added to a team he's a member of.
|
|
103
|
+
assert.equal(generalConversation.displayName, team.displayName);
|
|
104
|
+
assert.equal(teamConversation.displayName, groupConversation.displayName);
|
|
105
|
+
|
|
106
|
+
return kirk.webex.internal.conversation.get(groupConversation);
|
|
107
|
+
})
|
|
108
|
+
.then((conversation) => {
|
|
109
|
+
assert.isDefined(conversation.team);
|
|
110
|
+
assert.equal(conversation.team.id, team.id);
|
|
111
|
+
}));
|
|
112
|
+
});
|
|
149
113
|
|
|
150
|
-
|
|
151
|
-
|
|
114
|
+
describe('#addMember()', () => {
|
|
115
|
+
let additionalConversation, team;
|
|
152
116
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
117
|
+
before(() =>
|
|
118
|
+
kirk.webex.internal.team
|
|
119
|
+
.create({
|
|
120
|
+
displayName: `team-${uuid.v4()}`,
|
|
121
|
+
participants: [kirk],
|
|
122
|
+
})
|
|
123
|
+
.then((res) => {
|
|
124
|
+
team = res;
|
|
125
|
+
|
|
126
|
+
return kirk.webex.internal.team
|
|
127
|
+
.createConversation(team, {
|
|
128
|
+
displayName: `team-conversation-${uuid.v4()}`,
|
|
129
|
+
participants: [kirk],
|
|
130
|
+
})
|
|
131
|
+
.then((conversation) => {
|
|
132
|
+
additionalConversation = conversation;
|
|
133
|
+
});
|
|
156
134
|
})
|
|
157
|
-
|
|
158
|
-
assert.isDefined(spockTeam);
|
|
159
|
-
assert.notEqual(spockTeam.displayName, spockTeam.encryptedDisplayName);
|
|
160
|
-
assert.equal(spockTeam.displayName, team.displayName);
|
|
161
|
-
assert.equal(spockTeam.conversations.items.length, 2);
|
|
135
|
+
);
|
|
162
136
|
|
|
163
|
-
|
|
137
|
+
it('adds a team member to a team', () =>
|
|
138
|
+
kirk.webex.internal.team
|
|
139
|
+
.addMember(team, spock)
|
|
140
|
+
.then((activity) => {
|
|
141
|
+
assert.isActivity(activity);
|
|
142
|
+
assert.equal(activity.verb, 'add');
|
|
143
|
+
assert.equal(activity.target.id, team.id);
|
|
144
|
+
assert.equal(activity.object.id, spock.id);
|
|
164
145
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
assert.equal(spockAddtlConversation.displayName, additionalConversation.displayName);
|
|
168
|
-
assert.include(spockAddtlConversation.tags, 'NOT_JOINED');
|
|
146
|
+
return kirk.webex.internal.team.get(team, {
|
|
147
|
+
includeTeamMembers: true,
|
|
169
148
|
});
|
|
170
|
-
|
|
149
|
+
})
|
|
150
|
+
.then((team) => {
|
|
151
|
+
const spockEntry = find(team.teamMembers.items, {id: spock.id});
|
|
152
|
+
|
|
153
|
+
assert.isDefined(spockEntry);
|
|
154
|
+
assert.isUndefined(spockEntry.roomProperties);
|
|
155
|
+
|
|
156
|
+
// Assert spock can decrypt team and its rooms
|
|
157
|
+
return spock.webex.internal.team
|
|
158
|
+
.get(team, {
|
|
159
|
+
includeTeamConversations: true,
|
|
160
|
+
})
|
|
161
|
+
.then((spockTeam) => {
|
|
162
|
+
assert.isDefined(spockTeam);
|
|
163
|
+
assert.notEqual(spockTeam.displayName, spockTeam.encryptedDisplayName);
|
|
164
|
+
assert.equal(spockTeam.displayName, team.displayName);
|
|
165
|
+
assert.equal(spockTeam.conversations.items.length, 2);
|
|
166
|
+
|
|
167
|
+
const spockAddtlConversation = find(spockTeam.conversations.items, {
|
|
168
|
+
id: additionalConversation.id,
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
assert.isDefined(spockAddtlConversation);
|
|
172
|
+
assert.notEqual(
|
|
173
|
+
spockAddtlConversation.displayName,
|
|
174
|
+
spockAddtlConversation.encryptedDisplayName
|
|
175
|
+
);
|
|
176
|
+
assert.equal(
|
|
177
|
+
spockAddtlConversation.displayName,
|
|
178
|
+
additionalConversation.displayName
|
|
179
|
+
);
|
|
180
|
+
assert.include(spockAddtlConversation.tags, 'NOT_JOINED');
|
|
181
|
+
});
|
|
182
|
+
}));
|
|
171
183
|
});
|
|
172
184
|
|
|
173
185
|
describe('#assignModerator()', () => {
|
|
174
186
|
let team;
|
|
175
187
|
|
|
176
|
-
before(() =>
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
188
|
+
before(() =>
|
|
189
|
+
kirk.webex.internal.team
|
|
190
|
+
.create({
|
|
191
|
+
displayName: `team-${uuid.v4()}`,
|
|
192
|
+
participants: [kirk, spock],
|
|
193
|
+
})
|
|
194
|
+
.then((t) => {
|
|
195
|
+
team = t;
|
|
196
|
+
})
|
|
197
|
+
);
|
|
186
198
|
|
|
187
|
-
it('assigns a team moderator', () =>
|
|
188
|
-
.
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
199
|
+
it('assigns a team moderator', () =>
|
|
200
|
+
kirk.webex.internal.team
|
|
201
|
+
.assignModerator(team, spock)
|
|
202
|
+
.then((activity) => {
|
|
203
|
+
assert.isActivity(activity);
|
|
204
|
+
assert.equal(activity.verb, 'assignModerator');
|
|
205
|
+
assert.equal(activity.target.id, team.id);
|
|
206
|
+
assert.equal(activity.object.id, spock.id);
|
|
193
207
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
208
|
+
return kirk.webex.internal.team.get(team, {
|
|
209
|
+
includeTeamMembers: true,
|
|
210
|
+
});
|
|
211
|
+
})
|
|
212
|
+
.then((team) => {
|
|
213
|
+
const spockEntry = find(team.teamMembers.items, {id: spock.id});
|
|
200
214
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
215
|
+
assert.isDefined(spockEntry);
|
|
216
|
+
assert.isTrue(spockEntry.roomProperties.isModerator);
|
|
217
|
+
}));
|
|
204
218
|
});
|
|
205
219
|
|
|
206
220
|
describe('#archive()', () => {
|
|
207
221
|
let conversation, team;
|
|
208
222
|
|
|
209
|
-
before(() =>
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
223
|
+
before(() =>
|
|
224
|
+
kirk.webex.internal.team
|
|
225
|
+
.create({
|
|
226
|
+
displayName: `team-${uuid.v4()}`,
|
|
227
|
+
participants: [kirk],
|
|
228
|
+
})
|
|
229
|
+
.then((t) => {
|
|
230
|
+
team = t;
|
|
217
231
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}));
|
|
232
|
+
return kirk.webex.internal.team.createConversation(team, {
|
|
233
|
+
displayName: `team-conversation-${uuid.v4()}`,
|
|
234
|
+
participants: [kirk],
|
|
235
|
+
});
|
|
236
|
+
})
|
|
237
|
+
.then((c) => {
|
|
238
|
+
conversation = c;
|
|
239
|
+
})
|
|
240
|
+
);
|
|
228
241
|
|
|
229
242
|
it('archives a team conversation', () => {
|
|
230
243
|
assert.notInclude(conversation.tags, 'ARCHIVED');
|
|
231
244
|
assert.notInclude(conversation.tags, 'HIDDEN');
|
|
232
245
|
|
|
233
|
-
return kirk.webex.internal.team
|
|
246
|
+
return kirk.webex.internal.team
|
|
247
|
+
.archive(conversation)
|
|
234
248
|
.then((activity) => {
|
|
235
249
|
assert.isActivity(activity);
|
|
236
250
|
assert.equal(activity.verb, 'archive');
|
|
@@ -252,7 +266,8 @@ describe('plugin-team', () => {
|
|
|
252
266
|
it('archives a team', () => {
|
|
253
267
|
assert.isFalse(team.archived);
|
|
254
268
|
|
|
255
|
-
return kirk.webex.internal.team
|
|
269
|
+
return kirk.webex.internal.team
|
|
270
|
+
.archive(team)
|
|
256
271
|
.then((activity) => {
|
|
257
272
|
assert.isActivity(activity);
|
|
258
273
|
assert.equal(activity.verb, 'archive');
|
|
@@ -264,7 +279,9 @@ describe('plugin-team', () => {
|
|
|
264
279
|
.then((t) => {
|
|
265
280
|
assert.isTrue(t.archived);
|
|
266
281
|
|
|
267
|
-
const generalConversation = find(t.conversations.items, {
|
|
282
|
+
const generalConversation = find(t.conversations.items, {
|
|
283
|
+
id: team.generalConversationUuid,
|
|
284
|
+
});
|
|
268
285
|
|
|
269
286
|
assert.isDefined(generalConversation);
|
|
270
287
|
assert.include(generalConversation.tags, 'ARCHIVED');
|
|
@@ -276,170 +293,178 @@ describe('plugin-team', () => {
|
|
|
276
293
|
describe('#joinConversation()', () => {
|
|
277
294
|
let conversation, team;
|
|
278
295
|
|
|
279
|
-
before(() =>
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
team = t;
|
|
296
|
+
before(() =>
|
|
297
|
+
kirk.webex.internal.team
|
|
298
|
+
.create({
|
|
299
|
+
displayName: `team-${uuid.v4()}`,
|
|
300
|
+
participants: [kirk, spock],
|
|
301
|
+
})
|
|
302
|
+
.then((t) => {
|
|
303
|
+
team = t;
|
|
288
304
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
305
|
+
return kirk.webex.internal.team.createConversation(t, {
|
|
306
|
+
displayName: `team-room-${uuid.v4()}`,
|
|
307
|
+
participants: [kirk],
|
|
308
|
+
});
|
|
309
|
+
})
|
|
310
|
+
.then((c) => {
|
|
311
|
+
conversation = c;
|
|
312
|
+
})
|
|
313
|
+
);
|
|
297
314
|
|
|
298
|
-
it('adds the user to an open team conversation', () =>
|
|
299
|
-
.
|
|
315
|
+
it('adds the user to an open team conversation', () =>
|
|
316
|
+
spock.webex.internal.team
|
|
317
|
+
.joinConversation(team, conversation, spock.id)
|
|
318
|
+
.then((c) => assert.notInclude(c.tags, 'NOT_JOINED')));
|
|
300
319
|
});
|
|
301
320
|
|
|
302
321
|
describe('#removeConversation()', () => {
|
|
303
322
|
let conversation, team;
|
|
304
323
|
|
|
305
|
-
before(() =>
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
team = t;
|
|
324
|
+
before(() =>
|
|
325
|
+
kirk.webex.internal.team
|
|
326
|
+
.create({
|
|
327
|
+
displayName: `team-${uuid.v4()}`,
|
|
328
|
+
participants: [kirk, spock],
|
|
329
|
+
})
|
|
330
|
+
.then((t) => {
|
|
331
|
+
team = t;
|
|
314
332
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
333
|
+
return kirk.webex.internal.team.createConversation(t, {
|
|
334
|
+
displayName: `team-room-${uuid.v4()}`,
|
|
335
|
+
participants: [kirk],
|
|
336
|
+
});
|
|
337
|
+
})
|
|
338
|
+
.then((c) => {
|
|
339
|
+
conversation = c;
|
|
340
|
+
})
|
|
341
|
+
);
|
|
342
|
+
|
|
343
|
+
it('removes a team conversation from a team', () =>
|
|
344
|
+
kirk.webex.internal.team
|
|
345
|
+
.removeConversation(team, conversation)
|
|
346
|
+
.then((activity) => {
|
|
347
|
+
assert.isActivity(activity);
|
|
348
|
+
assert.equal(activity.verb, 'remove');
|
|
349
|
+
assert.equal(activity.target.id, team.id);
|
|
350
|
+
assert.equal(activity.object.id, conversation.id);
|
|
351
|
+
|
|
352
|
+
return kirk.webex.internal.team.get(team, {includeTeamConversations: true});
|
|
353
|
+
})
|
|
354
|
+
.then((t) => {
|
|
355
|
+
assert.lengthOf(t.conversations.items, 1);
|
|
356
|
+
assert.isUndefined(find(t.conversations.items, {id: conversation.id}));
|
|
357
|
+
}));
|
|
337
358
|
});
|
|
338
359
|
|
|
339
360
|
describe('#removeMember()', () => {
|
|
340
361
|
let team;
|
|
341
362
|
|
|
342
|
-
before(() =>
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
363
|
+
before(() =>
|
|
364
|
+
kirk.webex.internal.team
|
|
365
|
+
.create({
|
|
366
|
+
displayName: `team-${uuid.v4()}`,
|
|
367
|
+
participants: [kirk, spock],
|
|
368
|
+
})
|
|
369
|
+
.then((t) => {
|
|
370
|
+
team = t;
|
|
371
|
+
})
|
|
372
|
+
);
|
|
352
373
|
|
|
353
|
-
it('removes a team member from a team', () =>
|
|
354
|
-
.
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
374
|
+
it('removes a team member from a team', () =>
|
|
375
|
+
kirk.webex.internal.team
|
|
376
|
+
.removeMember(team, spock)
|
|
377
|
+
.then((activity) => {
|
|
378
|
+
assert.isActivity(activity);
|
|
379
|
+
assert.equal(activity.verb, 'leave');
|
|
380
|
+
assert.equal(activity.target.id, team.id);
|
|
381
|
+
assert.equal(activity.object.id, spock.id);
|
|
359
382
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
383
|
+
return kirk.webex.internal.team.get(team, {
|
|
384
|
+
includeTeamMembers: true,
|
|
385
|
+
});
|
|
386
|
+
})
|
|
387
|
+
.then((team) => {
|
|
388
|
+
assert.equal(team.teamMembers.items.length, 1);
|
|
389
|
+
assert.equal(team.teamMembers.items[0].id, kirk.id);
|
|
390
|
+
}));
|
|
368
391
|
});
|
|
369
392
|
|
|
370
393
|
describe('#unassignModerator()', () => {
|
|
371
394
|
let team;
|
|
372
395
|
|
|
373
|
-
before(() =>
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
team = t;
|
|
396
|
+
before(() =>
|
|
397
|
+
kirk.webex.internal.team
|
|
398
|
+
.create({
|
|
399
|
+
displayName: `team-${uuid.v4()}`,
|
|
400
|
+
participants: [kirk, spock],
|
|
401
|
+
})
|
|
402
|
+
.then((t) => {
|
|
403
|
+
team = t;
|
|
382
404
|
|
|
383
|
-
|
|
384
|
-
|
|
405
|
+
return kirk.webex.internal.team.assignModerator(team, spock);
|
|
406
|
+
})
|
|
407
|
+
);
|
|
385
408
|
|
|
386
|
-
it('unassigns a team moderator', () =>
|
|
387
|
-
.
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
409
|
+
it('unassigns a team moderator', () =>
|
|
410
|
+
kirk.webex.internal.team
|
|
411
|
+
.unassignModerator(team, spock)
|
|
412
|
+
.then((activity) => {
|
|
413
|
+
assert.isActivity(activity);
|
|
414
|
+
assert.equal(activity.verb, 'unassignModerator');
|
|
415
|
+
assert.equal(activity.target.id, team.id);
|
|
416
|
+
assert.equal(activity.object.id, spock.id);
|
|
392
417
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
418
|
+
return kirk.webex.internal.team.get(team, {
|
|
419
|
+
includeTeamMembers: true,
|
|
420
|
+
});
|
|
421
|
+
})
|
|
422
|
+
.then((team) => {
|
|
423
|
+
const spockEntry = find(team.teamMembers.items, {id: spock.id});
|
|
399
424
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
425
|
+
assert.isDefined(spockEntry);
|
|
426
|
+
assert.isUndefined(spockEntry.roomProperties);
|
|
427
|
+
}));
|
|
403
428
|
});
|
|
404
429
|
|
|
405
430
|
describe('#unarchive()', () => {
|
|
406
431
|
let conversation, team;
|
|
407
432
|
|
|
408
|
-
before(() =>
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
433
|
+
before(() =>
|
|
434
|
+
kirk.webex.internal.team
|
|
435
|
+
.create({
|
|
436
|
+
displayName: `team-${uuid.v4()}`,
|
|
437
|
+
participants: [kirk],
|
|
438
|
+
})
|
|
439
|
+
.then((t) => {
|
|
440
|
+
team = t;
|
|
416
441
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
}));
|
|
442
|
+
return kirk.webex.internal.team.createConversation(team, {
|
|
443
|
+
displayName: `team-conversation-${uuid.v4()}`,
|
|
444
|
+
participants: [kirk],
|
|
445
|
+
});
|
|
446
|
+
})
|
|
447
|
+
.then((c) => {
|
|
448
|
+
conversation = c;
|
|
449
|
+
|
|
450
|
+
return Promise.all([
|
|
451
|
+
kirk.webex.internal.team.archive(conversation),
|
|
452
|
+
kirk.webex.internal.team.archive(team),
|
|
453
|
+
]);
|
|
454
|
+
})
|
|
455
|
+
.then(() => kirk.webex.internal.team.get(team, {includeTeamConversations: true}))
|
|
456
|
+
.then((t) => {
|
|
457
|
+
team = t;
|
|
458
|
+
conversation = find(team.conversations.items, {id: conversation.id});
|
|
459
|
+
})
|
|
460
|
+
);
|
|
437
461
|
|
|
438
462
|
it('unarchives a team conversation', () => {
|
|
439
463
|
assert.include(conversation.tags, 'ARCHIVED');
|
|
440
464
|
assert.include(conversation.tags, 'HIDDEN');
|
|
441
465
|
|
|
442
|
-
return kirk.webex.internal.team
|
|
466
|
+
return kirk.webex.internal.team
|
|
467
|
+
.unarchive(conversation)
|
|
443
468
|
.then((activity) => {
|
|
444
469
|
assert.isActivity(activity);
|
|
445
470
|
assert.equal(activity.verb, 'unarchive');
|
|
@@ -459,7 +484,8 @@ describe('plugin-team', () => {
|
|
|
459
484
|
it('unarchives a team', () => {
|
|
460
485
|
assert.isTrue(team.archived);
|
|
461
486
|
|
|
462
|
-
return kirk.webex.internal.team
|
|
487
|
+
return kirk.webex.internal.team
|
|
488
|
+
.unarchive(team)
|
|
463
489
|
.then((activity) => {
|
|
464
490
|
assert.isActivity(activity);
|
|
465
491
|
assert.equal(activity.verb, 'unarchive');
|
|
@@ -471,7 +497,9 @@ describe('plugin-team', () => {
|
|
|
471
497
|
.then((t) => {
|
|
472
498
|
assert.isFalse(t.archived);
|
|
473
499
|
|
|
474
|
-
const generalConversation = find(t.conversations.items, {
|
|
500
|
+
const generalConversation = find(t.conversations.items, {
|
|
501
|
+
id: team.generalConversationUuid,
|
|
502
|
+
});
|
|
475
503
|
|
|
476
504
|
assert.isDefined(generalConversation);
|
|
477
505
|
assert.notInclude(generalConversation.tags, 'ARCHIVED');
|
|
@@ -483,23 +511,25 @@ describe('plugin-team', () => {
|
|
|
483
511
|
describe('#update()', () => {
|
|
484
512
|
let team;
|
|
485
513
|
|
|
486
|
-
before(() =>
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
514
|
+
before(() =>
|
|
515
|
+
kirk.webex.internal.team
|
|
516
|
+
.create({
|
|
517
|
+
displayName: `team-${uuid.v4()}`,
|
|
518
|
+
participants: [kirk],
|
|
519
|
+
})
|
|
520
|
+
.then((t) => {
|
|
521
|
+
team = t;
|
|
522
|
+
})
|
|
523
|
+
);
|
|
495
524
|
|
|
496
525
|
it('updates a team displayName', () => {
|
|
497
526
|
const obj = {
|
|
498
527
|
displayName: `updated-team-title-${uuid.v4()}`,
|
|
499
|
-
objectType: 'team'
|
|
528
|
+
objectType: 'team',
|
|
500
529
|
};
|
|
501
530
|
|
|
502
|
-
return kirk.webex.internal.team
|
|
531
|
+
return kirk.webex.internal.team
|
|
532
|
+
.update(team, obj)
|
|
503
533
|
.then((activity) => {
|
|
504
534
|
assert.isActivity(activity);
|
|
505
535
|
assert.equal(activity.verb, 'update');
|
|
@@ -512,10 +542,11 @@ describe('plugin-team', () => {
|
|
|
512
542
|
it('updates a team summary', () => {
|
|
513
543
|
const obj = {
|
|
514
544
|
summary: `updated-team-summary-${uuid.v4()}`,
|
|
515
|
-
objectType: 'team'
|
|
545
|
+
objectType: 'team',
|
|
516
546
|
};
|
|
517
547
|
|
|
518
|
-
return kirk.webex.internal.team
|
|
548
|
+
return kirk.webex.internal.team
|
|
549
|
+
.update(team, obj)
|
|
519
550
|
.then((activity) => {
|
|
520
551
|
assert.isActivity(activity);
|
|
521
552
|
assert.equal(activity.verb, 'update');
|