@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,158 +1,158 @@
|
|
|
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 {find, findLast} from 'lodash';
|
|
11
|
-
import testUsers from '@webex/test-helper-test-users';
|
|
12
|
-
import uuid from 'uuid';
|
|
13
|
-
|
|
14
|
-
describe('plugin-team', () => {
|
|
15
|
-
let displayName, kirk, participants, webex, spock, summary, team;
|
|
16
|
-
|
|
17
|
-
before(() =>
|
|
18
|
-
testUsers.create({count: 3}).then((users) => {
|
|
19
|
-
participants = [kirk, spock] = users;
|
|
20
|
-
|
|
21
|
-
kirk.webex = webex = new WebexCore({
|
|
22
|
-
credentials: {
|
|
23
|
-
authorization: kirk.token,
|
|
24
|
-
},
|
|
25
|
-
config: {
|
|
26
|
-
conversation: {
|
|
27
|
-
keepEncryptedProperties: true,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
return webex.internal.mercury.connect();
|
|
33
|
-
})
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
beforeEach(() => {
|
|
37
|
-
displayName = `team-conv-name-${uuid.v4()}`;
|
|
38
|
-
summary = `team-summary-${uuid.v4()}`;
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
after(() => kirk && kirk.webex.internal.mercury.disconnect());
|
|
42
|
-
|
|
43
|
-
describe('#create()', () => {
|
|
44
|
-
it('creates a team with a multiple participants', () =>
|
|
45
|
-
webex.internal.team.create({displayName, participants: [kirk, spock]}).then((team) => {
|
|
46
|
-
assert.isInternalTeam(team);
|
|
47
|
-
assert.isNewEncryptedInternalTeam(team);
|
|
48
|
-
assert.lengthOf(team.teamMembers.items, 2);
|
|
49
|
-
|
|
50
|
-
// Kirk created the team and is the moderator, Spock is not.
|
|
51
|
-
const kirkEntry = find(team.teamMembers.items, {id: kirk.id});
|
|
52
|
-
|
|
53
|
-
assert.isDefined(kirkEntry);
|
|
54
|
-
assert.isDefined(kirkEntry.roomProperties.isModerator);
|
|
55
|
-
|
|
56
|
-
const spockEntry = find(team.teamMembers.items, {id: spock.id});
|
|
57
|
-
|
|
58
|
-
assert.isDefined(spockEntry);
|
|
59
|
-
assert.isUndefined(spockEntry.roomProperties);
|
|
60
|
-
}));
|
|
61
|
-
|
|
62
|
-
it('creates a team with a name and summary', () =>
|
|
63
|
-
webex.internal.team.create({displayName, summary, participants: [kirk]}).then((team) => {
|
|
64
|
-
assert.isInternalTeam(team);
|
|
65
|
-
assert.isNewEncryptedInternalTeam(team);
|
|
66
|
-
assert.lengthOf(team.teamMembers.items, 1);
|
|
67
|
-
|
|
68
|
-
assert.equal(team.displayName, displayName);
|
|
69
|
-
assert.equal(team.summary, summary);
|
|
70
|
-
}));
|
|
71
|
-
|
|
72
|
-
it('creates a team with a name but without a summary', () =>
|
|
73
|
-
webex.internal.team.create({displayName, participants: [kirk]}).then((team) => {
|
|
74
|
-
assert.isInternalTeam(team);
|
|
75
|
-
assert.isNewEncryptedInternalTeam(team);
|
|
76
|
-
assert.lengthOf(team.teamMembers.items, 1);
|
|
77
|
-
|
|
78
|
-
assert.equal(team.displayName, displayName);
|
|
79
|
-
assert.isUndefined(team.summary);
|
|
80
|
-
}));
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
describe('#createConversation()', () => {
|
|
84
|
-
before(() =>
|
|
85
|
-
webex.internal.team.create({displayName, participants}).then((t) => {
|
|
86
|
-
team = t;
|
|
87
|
-
})
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
beforeEach(() => {
|
|
91
|
-
displayName = `team-conv-name-${uuid.v4()}`;
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it('creates a team conversation with a single participant', () =>
|
|
95
|
-
webex.internal.team
|
|
96
|
-
.createConversation(team, {displayName, participants: [kirk]})
|
|
97
|
-
.then((tc) => {
|
|
98
|
-
assert.isInternalTeamConversation(tc);
|
|
99
|
-
assert.equal(tc.displayName, displayName);
|
|
100
|
-
|
|
101
|
-
assert.lengthOf(tc.participants.items, 1);
|
|
102
|
-
}));
|
|
103
|
-
|
|
104
|
-
it('creates a team conversation with multiple participants', () =>
|
|
105
|
-
webex.internal.team
|
|
106
|
-
.createConversation(team, {displayName, participants: [kirk, spock]})
|
|
107
|
-
.then((tc) => {
|
|
108
|
-
assert.isInternalTeamConversation(tc);
|
|
109
|
-
assert.lengthOf(tc.participants.items, 2);
|
|
110
|
-
}));
|
|
111
|
-
|
|
112
|
-
it('creates a team conversation containing all team members via `includeAllTeamMembers` parameter', () =>
|
|
113
|
-
webex.internal.team
|
|
114
|
-
.createConversation(
|
|
115
|
-
team,
|
|
116
|
-
{displayName, participants: [kirk]},
|
|
117
|
-
{includeAllTeamMembers: true}
|
|
118
|
-
)
|
|
119
|
-
.then((tc) => {
|
|
120
|
-
assert.isInternalTeamConversation(tc);
|
|
121
|
-
assert.lengthOf(tc.participants.items, 3);
|
|
122
|
-
}));
|
|
123
|
-
|
|
124
|
-
it("decrypts the 'add' activity appended to the general conversation after team room is created", () =>
|
|
125
|
-
webex.internal.team
|
|
126
|
-
.createConversation(
|
|
127
|
-
team,
|
|
128
|
-
{displayName, participants: [kirk]},
|
|
129
|
-
{includeAllTeamMembers: true}
|
|
130
|
-
)
|
|
131
|
-
.then((tc) =>
|
|
132
|
-
webex.internal.conversation
|
|
133
|
-
.get(find(team.conversations.items, {id: team.generalConversationUuid}), {
|
|
134
|
-
activitiesLimit: 10,
|
|
135
|
-
})
|
|
136
|
-
.then((teamGeneral) => {
|
|
137
|
-
assert.isConversation(teamGeneral);
|
|
138
|
-
const addActivity = findLast(
|
|
139
|
-
teamGeneral.activities.items,
|
|
140
|
-
(activity) =>
|
|
141
|
-
activity.verb === 'add' &&
|
|
142
|
-
activity.object.objectType === 'conversation' &&
|
|
143
|
-
activity.object.id === tc.id
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
assert.isDefined(addActivity);
|
|
147
|
-
assert.equal(addActivity.object.displayName, tc.displayName);
|
|
148
|
-
|
|
149
|
-
assert.isDefined(addActivity.object.encryptedDisplayName);
|
|
150
|
-
assert.notEqual(
|
|
151
|
-
addActivity.object.displayName,
|
|
152
|
-
addActivity.object.encryptedDisplayName
|
|
153
|
-
);
|
|
154
|
-
assert.equal(addActivity.object.displayName, displayName);
|
|
155
|
-
})
|
|
156
|
-
));
|
|
157
|
-
});
|
|
158
|
-
});
|
|
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 {find, findLast} from 'lodash';
|
|
11
|
+
import testUsers from '@webex/test-helper-test-users';
|
|
12
|
+
import uuid from 'uuid';
|
|
13
|
+
|
|
14
|
+
describe('plugin-team', () => {
|
|
15
|
+
let displayName, kirk, participants, webex, spock, summary, team;
|
|
16
|
+
|
|
17
|
+
before(() =>
|
|
18
|
+
testUsers.create({count: 3}).then((users) => {
|
|
19
|
+
participants = [kirk, spock] = users;
|
|
20
|
+
|
|
21
|
+
kirk.webex = webex = new WebexCore({
|
|
22
|
+
credentials: {
|
|
23
|
+
authorization: kirk.token,
|
|
24
|
+
},
|
|
25
|
+
config: {
|
|
26
|
+
conversation: {
|
|
27
|
+
keepEncryptedProperties: true,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return webex.internal.mercury.connect();
|
|
33
|
+
})
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
beforeEach(() => {
|
|
37
|
+
displayName = `team-conv-name-${uuid.v4()}`;
|
|
38
|
+
summary = `team-summary-${uuid.v4()}`;
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
after(() => kirk && kirk.webex.internal.mercury.disconnect());
|
|
42
|
+
|
|
43
|
+
describe('#create()', () => {
|
|
44
|
+
it('creates a team with a multiple participants', () =>
|
|
45
|
+
webex.internal.team.create({displayName, participants: [kirk, spock]}).then((team) => {
|
|
46
|
+
assert.isInternalTeam(team);
|
|
47
|
+
assert.isNewEncryptedInternalTeam(team);
|
|
48
|
+
assert.lengthOf(team.teamMembers.items, 2);
|
|
49
|
+
|
|
50
|
+
// Kirk created the team and is the moderator, Spock is not.
|
|
51
|
+
const kirkEntry = find(team.teamMembers.items, {id: kirk.id});
|
|
52
|
+
|
|
53
|
+
assert.isDefined(kirkEntry);
|
|
54
|
+
assert.isDefined(kirkEntry.roomProperties.isModerator);
|
|
55
|
+
|
|
56
|
+
const spockEntry = find(team.teamMembers.items, {id: spock.id});
|
|
57
|
+
|
|
58
|
+
assert.isDefined(spockEntry);
|
|
59
|
+
assert.isUndefined(spockEntry.roomProperties);
|
|
60
|
+
}));
|
|
61
|
+
|
|
62
|
+
it('creates a team with a name and summary', () =>
|
|
63
|
+
webex.internal.team.create({displayName, summary, participants: [kirk]}).then((team) => {
|
|
64
|
+
assert.isInternalTeam(team);
|
|
65
|
+
assert.isNewEncryptedInternalTeam(team);
|
|
66
|
+
assert.lengthOf(team.teamMembers.items, 1);
|
|
67
|
+
|
|
68
|
+
assert.equal(team.displayName, displayName);
|
|
69
|
+
assert.equal(team.summary, summary);
|
|
70
|
+
}));
|
|
71
|
+
|
|
72
|
+
it('creates a team with a name but without a summary', () =>
|
|
73
|
+
webex.internal.team.create({displayName, participants: [kirk]}).then((team) => {
|
|
74
|
+
assert.isInternalTeam(team);
|
|
75
|
+
assert.isNewEncryptedInternalTeam(team);
|
|
76
|
+
assert.lengthOf(team.teamMembers.items, 1);
|
|
77
|
+
|
|
78
|
+
assert.equal(team.displayName, displayName);
|
|
79
|
+
assert.isUndefined(team.summary);
|
|
80
|
+
}));
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe('#createConversation()', () => {
|
|
84
|
+
before(() =>
|
|
85
|
+
webex.internal.team.create({displayName, participants}).then((t) => {
|
|
86
|
+
team = t;
|
|
87
|
+
})
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
beforeEach(() => {
|
|
91
|
+
displayName = `team-conv-name-${uuid.v4()}`;
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('creates a team conversation with a single participant', () =>
|
|
95
|
+
webex.internal.team
|
|
96
|
+
.createConversation(team, {displayName, participants: [kirk]})
|
|
97
|
+
.then((tc) => {
|
|
98
|
+
assert.isInternalTeamConversation(tc);
|
|
99
|
+
assert.equal(tc.displayName, displayName);
|
|
100
|
+
|
|
101
|
+
assert.lengthOf(tc.participants.items, 1);
|
|
102
|
+
}));
|
|
103
|
+
|
|
104
|
+
it('creates a team conversation with multiple participants', () =>
|
|
105
|
+
webex.internal.team
|
|
106
|
+
.createConversation(team, {displayName, participants: [kirk, spock]})
|
|
107
|
+
.then((tc) => {
|
|
108
|
+
assert.isInternalTeamConversation(tc);
|
|
109
|
+
assert.lengthOf(tc.participants.items, 2);
|
|
110
|
+
}));
|
|
111
|
+
|
|
112
|
+
it('creates a team conversation containing all team members via `includeAllTeamMembers` parameter', () =>
|
|
113
|
+
webex.internal.team
|
|
114
|
+
.createConversation(
|
|
115
|
+
team,
|
|
116
|
+
{displayName, participants: [kirk]},
|
|
117
|
+
{includeAllTeamMembers: true}
|
|
118
|
+
)
|
|
119
|
+
.then((tc) => {
|
|
120
|
+
assert.isInternalTeamConversation(tc);
|
|
121
|
+
assert.lengthOf(tc.participants.items, 3);
|
|
122
|
+
}));
|
|
123
|
+
|
|
124
|
+
it("decrypts the 'add' activity appended to the general conversation after team room is created", () =>
|
|
125
|
+
webex.internal.team
|
|
126
|
+
.createConversation(
|
|
127
|
+
team,
|
|
128
|
+
{displayName, participants: [kirk]},
|
|
129
|
+
{includeAllTeamMembers: true}
|
|
130
|
+
)
|
|
131
|
+
.then((tc) =>
|
|
132
|
+
webex.internal.conversation
|
|
133
|
+
.get(find(team.conversations.items, {id: team.generalConversationUuid}), {
|
|
134
|
+
activitiesLimit: 10,
|
|
135
|
+
})
|
|
136
|
+
.then((teamGeneral) => {
|
|
137
|
+
assert.isConversation(teamGeneral);
|
|
138
|
+
const addActivity = findLast(
|
|
139
|
+
teamGeneral.activities.items,
|
|
140
|
+
(activity) =>
|
|
141
|
+
activity.verb === 'add' &&
|
|
142
|
+
activity.object.objectType === 'conversation' &&
|
|
143
|
+
activity.object.id === tc.id
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
assert.isDefined(addActivity);
|
|
147
|
+
assert.equal(addActivity.object.displayName, tc.displayName);
|
|
148
|
+
|
|
149
|
+
assert.isDefined(addActivity.object.encryptedDisplayName);
|
|
150
|
+
assert.notEqual(
|
|
151
|
+
addActivity.object.displayName,
|
|
152
|
+
addActivity.object.encryptedDisplayName
|
|
153
|
+
);
|
|
154
|
+
assert.equal(addActivity.object.displayName, displayName);
|
|
155
|
+
})
|
|
156
|
+
));
|
|
157
|
+
});
|
|
158
|
+
});
|