@webex/internal-plugin-team 2.59.3-next.1 → 2.59.4-next.1
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/.eslintrc.js +6 -6
- package/README.md +42 -42
- package/babel.config.js +3 -3
- package/dist/config.js +2 -2
- package/dist/config.js.map +1 -1
- package/dist/index.js +6 -8
- package/dist/index.js.map +1 -1
- package/dist/team.js +107 -109
- package/dist/team.js.map +1 -1
- package/jest.config.js +3 -3
- package/package.json +10 -10
- package/process +1 -1
- package/src/config.js +7 -7
- package/src/index.js +139 -139
- package/src/team.js +437 -437
- package/test/integration/spec/actions.js +560 -560
- package/test/integration/spec/create.js +158 -158
- package/test/integration/spec/get.js +198 -198
- package/test/integration/spec/mercury.js +108 -108
- package/test/unit/spec/team.js +153 -153
|
@@ -1,198 +1,198 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import '@webex/internal-plugin-device';
|
|
6
|
-
import '@webex/internal-plugin-team';
|
|
7
|
-
|
|
8
|
-
import {assert} from '@webex/test-helper-chai';
|
|
9
|
-
import WebexCore from '@webex/webex-core';
|
|
10
|
-
import {every, find, map} from 'lodash';
|
|
11
|
-
import testUsers from '@webex/test-helper-test-users';
|
|
12
|
-
import uuid from 'uuid';
|
|
13
|
-
|
|
14
|
-
function ensureGeneral(team, conversations) {
|
|
15
|
-
assert.isConversation(
|
|
16
|
-
find(
|
|
17
|
-
conversations,
|
|
18
|
-
(conversation) =>
|
|
19
|
-
team.generalConversationUuid === conversation.id && conversation.tags.includes('TEAM')
|
|
20
|
-
)
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
describe('plugin-team', () => {
|
|
25
|
-
let kirk, spock, team0, team1, teamConvo0, teamConvo1;
|
|
26
|
-
|
|
27
|
-
before(() =>
|
|
28
|
-
testUsers.create({count: 2}).then((users) => {
|
|
29
|
-
[kirk, spock] = users;
|
|
30
|
-
|
|
31
|
-
kirk.webex = new WebexCore({
|
|
32
|
-
credentials: {
|
|
33
|
-
authorization: kirk.token,
|
|
34
|
-
},
|
|
35
|
-
config: {
|
|
36
|
-
conversation: {
|
|
37
|
-
keepEncryptedProperties: true,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
spock.webex = new WebexCore({
|
|
43
|
-
credentials: {
|
|
44
|
-
authorization: spock.token,
|
|
45
|
-
},
|
|
46
|
-
config: {
|
|
47
|
-
conversation: {
|
|
48
|
-
keepEncryptedProperties: true,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
return Promise.all([
|
|
54
|
-
kirk.webex.internal.mercury.connect(),
|
|
55
|
-
spock.webex.internal.mercury.connect(),
|
|
56
|
-
]);
|
|
57
|
-
})
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
before(() => {
|
|
61
|
-
team0 = {
|
|
62
|
-
displayName: 'test-team-0',
|
|
63
|
-
summary: 'test-team-0-summary',
|
|
64
|
-
participants: [kirk, spock],
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
team1 = {
|
|
68
|
-
displayName: 'test-team-1',
|
|
69
|
-
participants: [kirk],
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
return Promise.all([
|
|
73
|
-
kirk.webex.internal.team.create(team0),
|
|
74
|
-
kirk.webex.internal.team.create(team1),
|
|
75
|
-
])
|
|
76
|
-
.then((teams) => {
|
|
77
|
-
team0 = teams[0];
|
|
78
|
-
team1 = teams[1];
|
|
79
|
-
|
|
80
|
-
const emptyRoom = {
|
|
81
|
-
displayName: `team-conversation-${uuid.v4()}`,
|
|
82
|
-
participants: [kirk],
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// Create two conversations for team 0
|
|
86
|
-
return Promise.all([
|
|
87
|
-
kirk.webex.internal.team.createConversation(team0, emptyRoom),
|
|
88
|
-
kirk.webex.internal.team.createConversation(team0, emptyRoom),
|
|
89
|
-
]);
|
|
90
|
-
})
|
|
91
|
-
.then((conversations) => {
|
|
92
|
-
[teamConvo0, teamConvo1] = conversations;
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
after(() =>
|
|
97
|
-
Promise.all([
|
|
98
|
-
kirk && kirk.webex.internal.mercury.disconnect(),
|
|
99
|
-
spock && spock.webex.internal.mercury.disconnect(),
|
|
100
|
-
])
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
describe('#get()', () => {
|
|
104
|
-
it('retrieves a team', () =>
|
|
105
|
-
kirk.webex.internal.team.get(team0).then((t) => {
|
|
106
|
-
assert.isInternalTeam(t);
|
|
107
|
-
assert.equal(t.id, team0.id);
|
|
108
|
-
assert.match(t.teamColor, team0.teamColor);
|
|
109
|
-
|
|
110
|
-
assert.equal(t.displayName, team0.displayName);
|
|
111
|
-
assert.equal(t.summary, team0.summary);
|
|
112
|
-
|
|
113
|
-
assert.lengthOf(t.teamMembers.items, 0);
|
|
114
|
-
assert.lengthOf(t.conversations.items, 0);
|
|
115
|
-
}));
|
|
116
|
-
|
|
117
|
-
it('retrieves a team with teamMembers', () =>
|
|
118
|
-
kirk.webex.internal.team.get(team0, {includeTeamMembers: true}).then((t) => {
|
|
119
|
-
assert.isInternalTeam(t);
|
|
120
|
-
assert.equal(t.id, team0.id);
|
|
121
|
-
assert.lengthOf(t.teamMembers.items, team0.teamMembers.items.length);
|
|
122
|
-
assert.lengthOf(t.conversations.items, 0);
|
|
123
|
-
}));
|
|
124
|
-
|
|
125
|
-
it('retrieves a team with conversations', () =>
|
|
126
|
-
kirk.webex.internal.team.get(team0, {includeTeamConversations: true}).then((t) => {
|
|
127
|
-
assert.isInternalTeam(t);
|
|
128
|
-
assert.equal(t.id, team0.id);
|
|
129
|
-
assert.lengthOf(t.teamMembers.items, 0);
|
|
130
|
-
// Note we get the general conversation back in addition to the 2 added rooms
|
|
131
|
-
assert.lengthOf(t.conversations.items, 3);
|
|
132
|
-
ensureGeneral(t, t.conversations.items);
|
|
133
|
-
assert.include(map(t.conversations.items, 'url'), teamConvo0.url);
|
|
134
|
-
assert.include(map(t.conversations.items, 'url'), teamConvo1.url);
|
|
135
|
-
}));
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
describe('#listConversations()', () => {
|
|
139
|
-
it('retrieves and decrypts conversations for a team', () =>
|
|
140
|
-
kirk.webex.internal.team.listConversations(team0).then((conversations) => {
|
|
141
|
-
assert.lengthOf(conversations, 3);
|
|
142
|
-
ensureGeneral(team0, conversations);
|
|
143
|
-
assert.include(map(conversations, 'url'), teamConvo0.url);
|
|
144
|
-
assert.include(map(conversations, 'url'), teamConvo1.url);
|
|
145
|
-
|
|
146
|
-
conversations.forEach((c) => {
|
|
147
|
-
assert.isInternalTeamConversation(c);
|
|
148
|
-
assert.include(map([team0, teamConvo0, teamConvo1], 'displayName'), c.displayName);
|
|
149
|
-
});
|
|
150
|
-
}));
|
|
151
|
-
|
|
152
|
-
it('retrieves and decypts conversations for a team (including unjoined)', () =>
|
|
153
|
-
spock.webex.internal.team.listConversations(team0).then((conversations) => {
|
|
154
|
-
assert.lengthOf(conversations, 3);
|
|
155
|
-
ensureGeneral(team0, conversations);
|
|
156
|
-
assert.include(map(conversations, 'url'), teamConvo0.url);
|
|
157
|
-
assert.include(map(conversations, 'url'), teamConvo1.url);
|
|
158
|
-
|
|
159
|
-
conversations.forEach((c) => {
|
|
160
|
-
assert.isInternalTeamConversation(c);
|
|
161
|
-
assert.include(map([team0, teamConvo0, teamConvo1], 'displayName'), c.displayName);
|
|
162
|
-
});
|
|
163
|
-
}));
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
describe('#list()', () => {
|
|
167
|
-
it('retrieves a list of teams', () =>
|
|
168
|
-
kirk.webex.internal.team.list().then((teams) => {
|
|
169
|
-
assert.equal(teams.length, 2);
|
|
170
|
-
|
|
171
|
-
every(teams, (team) => {
|
|
172
|
-
assert.lengthOf(team.teamMembers.items, 0);
|
|
173
|
-
assert.lengthOf(team.conversations.items, 0);
|
|
174
|
-
});
|
|
175
|
-
}));
|
|
176
|
-
|
|
177
|
-
it('retrieves a list of teams with teamMembers', () =>
|
|
178
|
-
kirk.webex.internal.team.list({includeTeamMembers: true}).then((teams) => {
|
|
179
|
-
assert.equal(teams.length, 2);
|
|
180
|
-
|
|
181
|
-
every(teams, (team) => {
|
|
182
|
-
assert.isAbove(team.teamMembers.items.length, 0);
|
|
183
|
-
assert.lengthOf(team.conversations.items, 0);
|
|
184
|
-
});
|
|
185
|
-
}));
|
|
186
|
-
|
|
187
|
-
it('retrieves a list of teams with conversations', () =>
|
|
188
|
-
kirk.webex.internal.team.list({includeTeamConversations: true}).then((teams) => {
|
|
189
|
-
assert.equal(teams.length, 2);
|
|
190
|
-
|
|
191
|
-
every(teams, (team) => {
|
|
192
|
-
assert.lengthOf(team.teamMembers.items, 0);
|
|
193
|
-
assert.isAbove(team.conversations.items.length, 0);
|
|
194
|
-
ensureGeneral(team, team.conversations.items);
|
|
195
|
-
});
|
|
196
|
-
}));
|
|
197
|
-
});
|
|
198
|
-
});
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import '@webex/internal-plugin-device';
|
|
6
|
+
import '@webex/internal-plugin-team';
|
|
7
|
+
|
|
8
|
+
import {assert} from '@webex/test-helper-chai';
|
|
9
|
+
import WebexCore from '@webex/webex-core';
|
|
10
|
+
import {every, find, map} from 'lodash';
|
|
11
|
+
import testUsers from '@webex/test-helper-test-users';
|
|
12
|
+
import uuid from 'uuid';
|
|
13
|
+
|
|
14
|
+
function ensureGeneral(team, conversations) {
|
|
15
|
+
assert.isConversation(
|
|
16
|
+
find(
|
|
17
|
+
conversations,
|
|
18
|
+
(conversation) =>
|
|
19
|
+
team.generalConversationUuid === conversation.id && conversation.tags.includes('TEAM')
|
|
20
|
+
)
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
describe('plugin-team', () => {
|
|
25
|
+
let kirk, spock, team0, team1, teamConvo0, teamConvo1;
|
|
26
|
+
|
|
27
|
+
before(() =>
|
|
28
|
+
testUsers.create({count: 2}).then((users) => {
|
|
29
|
+
[kirk, spock] = users;
|
|
30
|
+
|
|
31
|
+
kirk.webex = new WebexCore({
|
|
32
|
+
credentials: {
|
|
33
|
+
authorization: kirk.token,
|
|
34
|
+
},
|
|
35
|
+
config: {
|
|
36
|
+
conversation: {
|
|
37
|
+
keepEncryptedProperties: true,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
spock.webex = new WebexCore({
|
|
43
|
+
credentials: {
|
|
44
|
+
authorization: spock.token,
|
|
45
|
+
},
|
|
46
|
+
config: {
|
|
47
|
+
conversation: {
|
|
48
|
+
keepEncryptedProperties: true,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
return Promise.all([
|
|
54
|
+
kirk.webex.internal.mercury.connect(),
|
|
55
|
+
spock.webex.internal.mercury.connect(),
|
|
56
|
+
]);
|
|
57
|
+
})
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
before(() => {
|
|
61
|
+
team0 = {
|
|
62
|
+
displayName: 'test-team-0',
|
|
63
|
+
summary: 'test-team-0-summary',
|
|
64
|
+
participants: [kirk, spock],
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
team1 = {
|
|
68
|
+
displayName: 'test-team-1',
|
|
69
|
+
participants: [kirk],
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return Promise.all([
|
|
73
|
+
kirk.webex.internal.team.create(team0),
|
|
74
|
+
kirk.webex.internal.team.create(team1),
|
|
75
|
+
])
|
|
76
|
+
.then((teams) => {
|
|
77
|
+
team0 = teams[0];
|
|
78
|
+
team1 = teams[1];
|
|
79
|
+
|
|
80
|
+
const emptyRoom = {
|
|
81
|
+
displayName: `team-conversation-${uuid.v4()}`,
|
|
82
|
+
participants: [kirk],
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Create two conversations for team 0
|
|
86
|
+
return Promise.all([
|
|
87
|
+
kirk.webex.internal.team.createConversation(team0, emptyRoom),
|
|
88
|
+
kirk.webex.internal.team.createConversation(team0, emptyRoom),
|
|
89
|
+
]);
|
|
90
|
+
})
|
|
91
|
+
.then((conversations) => {
|
|
92
|
+
[teamConvo0, teamConvo1] = conversations;
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
after(() =>
|
|
97
|
+
Promise.all([
|
|
98
|
+
kirk && kirk.webex.internal.mercury.disconnect(),
|
|
99
|
+
spock && spock.webex.internal.mercury.disconnect(),
|
|
100
|
+
])
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
describe('#get()', () => {
|
|
104
|
+
it('retrieves a team', () =>
|
|
105
|
+
kirk.webex.internal.team.get(team0).then((t) => {
|
|
106
|
+
assert.isInternalTeam(t);
|
|
107
|
+
assert.equal(t.id, team0.id);
|
|
108
|
+
assert.match(t.teamColor, team0.teamColor);
|
|
109
|
+
|
|
110
|
+
assert.equal(t.displayName, team0.displayName);
|
|
111
|
+
assert.equal(t.summary, team0.summary);
|
|
112
|
+
|
|
113
|
+
assert.lengthOf(t.teamMembers.items, 0);
|
|
114
|
+
assert.lengthOf(t.conversations.items, 0);
|
|
115
|
+
}));
|
|
116
|
+
|
|
117
|
+
it('retrieves a team with teamMembers', () =>
|
|
118
|
+
kirk.webex.internal.team.get(team0, {includeTeamMembers: true}).then((t) => {
|
|
119
|
+
assert.isInternalTeam(t);
|
|
120
|
+
assert.equal(t.id, team0.id);
|
|
121
|
+
assert.lengthOf(t.teamMembers.items, team0.teamMembers.items.length);
|
|
122
|
+
assert.lengthOf(t.conversations.items, 0);
|
|
123
|
+
}));
|
|
124
|
+
|
|
125
|
+
it('retrieves a team with conversations', () =>
|
|
126
|
+
kirk.webex.internal.team.get(team0, {includeTeamConversations: true}).then((t) => {
|
|
127
|
+
assert.isInternalTeam(t);
|
|
128
|
+
assert.equal(t.id, team0.id);
|
|
129
|
+
assert.lengthOf(t.teamMembers.items, 0);
|
|
130
|
+
// Note we get the general conversation back in addition to the 2 added rooms
|
|
131
|
+
assert.lengthOf(t.conversations.items, 3);
|
|
132
|
+
ensureGeneral(t, t.conversations.items);
|
|
133
|
+
assert.include(map(t.conversations.items, 'url'), teamConvo0.url);
|
|
134
|
+
assert.include(map(t.conversations.items, 'url'), teamConvo1.url);
|
|
135
|
+
}));
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
describe('#listConversations()', () => {
|
|
139
|
+
it('retrieves and decrypts conversations for a team', () =>
|
|
140
|
+
kirk.webex.internal.team.listConversations(team0).then((conversations) => {
|
|
141
|
+
assert.lengthOf(conversations, 3);
|
|
142
|
+
ensureGeneral(team0, conversations);
|
|
143
|
+
assert.include(map(conversations, 'url'), teamConvo0.url);
|
|
144
|
+
assert.include(map(conversations, 'url'), teamConvo1.url);
|
|
145
|
+
|
|
146
|
+
conversations.forEach((c) => {
|
|
147
|
+
assert.isInternalTeamConversation(c);
|
|
148
|
+
assert.include(map([team0, teamConvo0, teamConvo1], 'displayName'), c.displayName);
|
|
149
|
+
});
|
|
150
|
+
}));
|
|
151
|
+
|
|
152
|
+
it('retrieves and decypts conversations for a team (including unjoined)', () =>
|
|
153
|
+
spock.webex.internal.team.listConversations(team0).then((conversations) => {
|
|
154
|
+
assert.lengthOf(conversations, 3);
|
|
155
|
+
ensureGeneral(team0, conversations);
|
|
156
|
+
assert.include(map(conversations, 'url'), teamConvo0.url);
|
|
157
|
+
assert.include(map(conversations, 'url'), teamConvo1.url);
|
|
158
|
+
|
|
159
|
+
conversations.forEach((c) => {
|
|
160
|
+
assert.isInternalTeamConversation(c);
|
|
161
|
+
assert.include(map([team0, teamConvo0, teamConvo1], 'displayName'), c.displayName);
|
|
162
|
+
});
|
|
163
|
+
}));
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
describe('#list()', () => {
|
|
167
|
+
it('retrieves a list of teams', () =>
|
|
168
|
+
kirk.webex.internal.team.list().then((teams) => {
|
|
169
|
+
assert.equal(teams.length, 2);
|
|
170
|
+
|
|
171
|
+
every(teams, (team) => {
|
|
172
|
+
assert.lengthOf(team.teamMembers.items, 0);
|
|
173
|
+
assert.lengthOf(team.conversations.items, 0);
|
|
174
|
+
});
|
|
175
|
+
}));
|
|
176
|
+
|
|
177
|
+
it('retrieves a list of teams with teamMembers', () =>
|
|
178
|
+
kirk.webex.internal.team.list({includeTeamMembers: true}).then((teams) => {
|
|
179
|
+
assert.equal(teams.length, 2);
|
|
180
|
+
|
|
181
|
+
every(teams, (team) => {
|
|
182
|
+
assert.isAbove(team.teamMembers.items.length, 0);
|
|
183
|
+
assert.lengthOf(team.conversations.items, 0);
|
|
184
|
+
});
|
|
185
|
+
}));
|
|
186
|
+
|
|
187
|
+
it('retrieves a list of teams with conversations', () =>
|
|
188
|
+
kirk.webex.internal.team.list({includeTeamConversations: true}).then((teams) => {
|
|
189
|
+
assert.equal(teams.length, 2);
|
|
190
|
+
|
|
191
|
+
every(teams, (team) => {
|
|
192
|
+
assert.lengthOf(team.teamMembers.items, 0);
|
|
193
|
+
assert.isAbove(team.conversations.items.length, 0);
|
|
194
|
+
ensureGeneral(team, team.conversations.items);
|
|
195
|
+
});
|
|
196
|
+
}));
|
|
197
|
+
});
|
|
198
|
+
});
|
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import '@webex/internal-plugin-device';
|
|
6
|
-
import '@webex/internal-plugin-team';
|
|
7
|
-
|
|
8
|
-
import {assert} from '@webex/test-helper-chai';
|
|
9
|
-
import WebexCore from '@webex/webex-core';
|
|
10
|
-
import {expectActivity} from '@webex/test-helper-mocha';
|
|
11
|
-
import {get} from 'lodash';
|
|
12
|
-
import testUsers from '@webex/test-helper-test-users';
|
|
13
|
-
import uuid from 'uuid';
|
|
14
|
-
|
|
15
|
-
describe('plugin-team', () => {
|
|
16
|
-
describe('Team', () => {
|
|
17
|
-
let kirk, spock;
|
|
18
|
-
|
|
19
|
-
before('create users', () =>
|
|
20
|
-
testUsers.create({count: 2}).then((users) => {
|
|
21
|
-
[kirk, spock] = users;
|
|
22
|
-
|
|
23
|
-
kirk.webex = new WebexCore({
|
|
24
|
-
credentials: {
|
|
25
|
-
authorization: kirk.token,
|
|
26
|
-
},
|
|
27
|
-
config: {
|
|
28
|
-
conversation: {
|
|
29
|
-
keepEncryptedProperties: true,
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
spock.webex = new WebexCore({
|
|
35
|
-
credentials: {
|
|
36
|
-
authorization: spock.token,
|
|
37
|
-
},
|
|
38
|
-
config: {
|
|
39
|
-
conversation: {
|
|
40
|
-
keepEncryptedProperties: true,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
return Promise.all([
|
|
46
|
-
kirk.webex.internal.mercury.connect(),
|
|
47
|
-
spock.webex.internal.mercury.connect(),
|
|
48
|
-
]);
|
|
49
|
-
})
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
after(() =>
|
|
53
|
-
Promise.all([
|
|
54
|
-
kirk && kirk.webex.internal.mercury.disconnect(),
|
|
55
|
-
spock && spock.webex.internal.mercury.disconnect(),
|
|
56
|
-
])
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
describe('when mercury event is received', () => {
|
|
60
|
-
let teamConvo, team;
|
|
61
|
-
|
|
62
|
-
before('create team', () =>
|
|
63
|
-
kirk.webex.internal.team
|
|
64
|
-
.create({
|
|
65
|
-
displayName: `team-${uuid.v4()}`,
|
|
66
|
-
participants: [kirk, spock],
|
|
67
|
-
})
|
|
68
|
-
.then((t) => {
|
|
69
|
-
team = t;
|
|
70
|
-
})
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
before('create team conversation', () =>
|
|
74
|
-
kirk.webex.internal.team
|
|
75
|
-
.createConversation(team, {
|
|
76
|
-
displayName: `team-conversation-${uuid.v4()}`,
|
|
77
|
-
participants: [kirk],
|
|
78
|
-
})
|
|
79
|
-
.then((c) => {
|
|
80
|
-
teamConvo = c;
|
|
81
|
-
})
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
it('updates the displayName of an unjoined team convo', () => {
|
|
85
|
-
const update = {
|
|
86
|
-
displayName: `updated-team-convo--${uuid.v4()}`,
|
|
87
|
-
objectType: 'conversation',
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const activityChecker = (activity) =>
|
|
91
|
-
activity.verb === 'update' && get(activity, 'object.objectType') === 'teamRoomStatus';
|
|
92
|
-
|
|
93
|
-
return Promise.all([
|
|
94
|
-
expectActivity(
|
|
95
|
-
20000,
|
|
96
|
-
'event:conversation.activity',
|
|
97
|
-
spock.webex.internal.mercury,
|
|
98
|
-
activityChecker,
|
|
99
|
-
'teamRoomStatus update expected'
|
|
100
|
-
),
|
|
101
|
-
kirk.webex.internal.team.update(teamConvo, update),
|
|
102
|
-
]).then(([activity]) => {
|
|
103
|
-
assert.equal(activity.object.activityEvent.object.displayName, update.displayName);
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
});
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import '@webex/internal-plugin-device';
|
|
6
|
+
import '@webex/internal-plugin-team';
|
|
7
|
+
|
|
8
|
+
import {assert} from '@webex/test-helper-chai';
|
|
9
|
+
import WebexCore from '@webex/webex-core';
|
|
10
|
+
import {expectActivity} from '@webex/test-helper-mocha';
|
|
11
|
+
import {get} from 'lodash';
|
|
12
|
+
import testUsers from '@webex/test-helper-test-users';
|
|
13
|
+
import uuid from 'uuid';
|
|
14
|
+
|
|
15
|
+
describe('plugin-team', () => {
|
|
16
|
+
describe('Team', () => {
|
|
17
|
+
let kirk, spock;
|
|
18
|
+
|
|
19
|
+
before('create users', () =>
|
|
20
|
+
testUsers.create({count: 2}).then((users) => {
|
|
21
|
+
[kirk, spock] = users;
|
|
22
|
+
|
|
23
|
+
kirk.webex = new WebexCore({
|
|
24
|
+
credentials: {
|
|
25
|
+
authorization: kirk.token,
|
|
26
|
+
},
|
|
27
|
+
config: {
|
|
28
|
+
conversation: {
|
|
29
|
+
keepEncryptedProperties: true,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
spock.webex = new WebexCore({
|
|
35
|
+
credentials: {
|
|
36
|
+
authorization: spock.token,
|
|
37
|
+
},
|
|
38
|
+
config: {
|
|
39
|
+
conversation: {
|
|
40
|
+
keepEncryptedProperties: true,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return Promise.all([
|
|
46
|
+
kirk.webex.internal.mercury.connect(),
|
|
47
|
+
spock.webex.internal.mercury.connect(),
|
|
48
|
+
]);
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
after(() =>
|
|
53
|
+
Promise.all([
|
|
54
|
+
kirk && kirk.webex.internal.mercury.disconnect(),
|
|
55
|
+
spock && spock.webex.internal.mercury.disconnect(),
|
|
56
|
+
])
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
describe('when mercury event is received', () => {
|
|
60
|
+
let teamConvo, team;
|
|
61
|
+
|
|
62
|
+
before('create team', () =>
|
|
63
|
+
kirk.webex.internal.team
|
|
64
|
+
.create({
|
|
65
|
+
displayName: `team-${uuid.v4()}`,
|
|
66
|
+
participants: [kirk, spock],
|
|
67
|
+
})
|
|
68
|
+
.then((t) => {
|
|
69
|
+
team = t;
|
|
70
|
+
})
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
before('create team conversation', () =>
|
|
74
|
+
kirk.webex.internal.team
|
|
75
|
+
.createConversation(team, {
|
|
76
|
+
displayName: `team-conversation-${uuid.v4()}`,
|
|
77
|
+
participants: [kirk],
|
|
78
|
+
})
|
|
79
|
+
.then((c) => {
|
|
80
|
+
teamConvo = c;
|
|
81
|
+
})
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
it('updates the displayName of an unjoined team convo', () => {
|
|
85
|
+
const update = {
|
|
86
|
+
displayName: `updated-team-convo--${uuid.v4()}`,
|
|
87
|
+
objectType: 'conversation',
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const activityChecker = (activity) =>
|
|
91
|
+
activity.verb === 'update' && get(activity, 'object.objectType') === 'teamRoomStatus';
|
|
92
|
+
|
|
93
|
+
return Promise.all([
|
|
94
|
+
expectActivity(
|
|
95
|
+
20000,
|
|
96
|
+
'event:conversation.activity',
|
|
97
|
+
spock.webex.internal.mercury,
|
|
98
|
+
activityChecker,
|
|
99
|
+
'teamRoomStatus update expected'
|
|
100
|
+
),
|
|
101
|
+
kirk.webex.internal.team.update(teamConvo, update),
|
|
102
|
+
]).then(([activity]) => {
|
|
103
|
+
assert.equal(activity.object.activityEvent.object.displayName, update.displayName);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
});
|