@webex/plugin-teams 3.0.0-beta.14 → 3.0.0-beta.15
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 +3 -6
- package/dist/teams.js +2 -2
- package/dist/teams.js.map +1 -1
- package/package.json +9 -9
- package/src/teams.js +10 -14
- package/test/integration/spec/teams.js +124 -104
package/README.md
CHANGED
|
@@ -29,15 +29,12 @@ npm install --save @webex/plugin-teams
|
|
|
29
29
|
## Usage
|
|
30
30
|
|
|
31
31
|
```js
|
|
32
|
-
|
|
33
32
|
const Webex = require('webex');
|
|
34
33
|
|
|
35
34
|
const webex = Webex.init();
|
|
36
|
-
webex.teams.get(id)
|
|
37
|
-
.
|
|
38
|
-
|
|
39
|
-
})
|
|
40
|
-
|
|
35
|
+
webex.teams.get(id).then((team) => {
|
|
36
|
+
console.log(team);
|
|
37
|
+
});
|
|
41
38
|
```
|
|
42
39
|
|
|
43
40
|
## Maintainers
|
package/dist/teams.js
CHANGED
|
@@ -23,7 +23,7 @@ var _webexCore = require("@webex/webex-core");
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* @class
|
|
26
|
+
* @class
|
|
27
27
|
*/
|
|
28
28
|
var Teams = _webexCore.WebexPlugin.extend({
|
|
29
29
|
/**
|
|
@@ -164,7 +164,7 @@ var Teams = _webexCore.WebexPlugin.extend({
|
|
|
164
164
|
return res.body;
|
|
165
165
|
});
|
|
166
166
|
},
|
|
167
|
-
version: "3.0.0-beta.
|
|
167
|
+
version: "3.0.0-beta.15"
|
|
168
168
|
});
|
|
169
169
|
|
|
170
170
|
var _default = Teams;
|
package/dist/teams.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Teams","WebexPlugin","extend","create","team","request","method","service","resource","body","then","res","get","options","id","qs","items","list","Page","webex","update"],"sources":["teams.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {WebexPlugin, Page} from '@webex/webex-core';\n\n/**\n * @typedef {Object} TeamObject\n * @property {string} id - (server generated) Unique identifier for the team\n * @property {string} name - The name of the team\n * @property {isoDate} created - (server generated) The date and time that the\n * team was created\n */\n\n/**\n* @class\n */\nconst Teams = WebexPlugin.extend({\n /**\n * Create a new team.\n * @instance\n * @param {TeamObject} team\n * @returns {Promise<TeamObject>}\n * @memberof Teams\n * @example\n * webex.teams.create({name: 'Create Team Example'})\n * .then(function(team) {\n * var assert = require('assert');\n * assert(team.id);\n * assert(team.name);\n * assert(team.created);\n * return 'success';\n * });\n * // => success\n */\n create(team) {\n return this.request({\n method: 'POST',\n service: 'hydra',\n resource: 'teams',\n body: team
|
|
1
|
+
{"version":3,"names":["Teams","WebexPlugin","extend","create","team","request","method","service","resource","body","then","res","get","options","id","qs","items","list","Page","webex","update"],"sources":["teams.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {WebexPlugin, Page} from '@webex/webex-core';\n\n/**\n * @typedef {Object} TeamObject\n * @property {string} id - (server generated) Unique identifier for the team\n * @property {string} name - The name of the team\n * @property {isoDate} created - (server generated) The date and time that the\n * team was created\n */\n\n/**\n * @class\n */\nconst Teams = WebexPlugin.extend({\n /**\n * Create a new team.\n * @instance\n * @param {TeamObject} team\n * @returns {Promise<TeamObject>}\n * @memberof Teams\n * @example\n * webex.teams.create({name: 'Create Team Example'})\n * .then(function(team) {\n * var assert = require('assert');\n * assert(team.id);\n * assert(team.name);\n * assert(team.created);\n * return 'success';\n * });\n * // => success\n */\n create(team) {\n return this.request({\n method: 'POST',\n service: 'hydra',\n resource: 'teams',\n body: team,\n }).then((res) => res.body);\n },\n\n /**\n * Returns a single team\n * @instance\n * @param {TeamObject|string} team\n * @param {Object} options\n * @returns {Promise<TeamObject>}\n * @memberof Teams\n * @example\n * var team;\n * webex.teams.create({name: 'Get Team Example'})\n * .then(function(r) {\n * team = r;\n * return webex.teams.get(team.id);\n * })\n * .then(function(team2) {\n * var assert = require('assert');\n * assert.equal(team2.id, team.id);\n * return 'success';\n * });\n * // => success\n */\n get(team, options) {\n const id = team.id || team;\n\n return this.request({\n service: 'hydra',\n resource: `teams/${id}`,\n qs: options,\n }).then((res) => res.body.items || res.body);\n },\n\n /**\n * List teams.\n * @instance\n * @param {object} options\n * @param {object} options.max Limit the maximum number of teams in the\n * response.\n * @returns {Promise<Page<TeamObject>>}\n * @memberof Teams\n * @example\n * var createdRooms;\n * Promise.all([\n * webex.teams.create({name: 'List Teams Example 1'}),\n * webex.teams.create({name: 'List Teams Example 2'}),\n * webex.teams.create({name: 'List Teams Example 3'})\n * ])\n * .then(function(r) {\n * createdRooms = r;\n * return webex.teams.list({max: 3});\n * })\n * .then(function(teams) {\n * var assert = require('assert');\n * assert(teams.length === 3);\n * for (var i = 0; i < teams.items.length; i+= 1) {\n * assert(createdRooms.filter(function(room) {\n * return room.id === teams.items[i].id;\n * }).length === 1);\n * }\n * return 'success';\n * });\n * // => success\n */\n list(options) {\n return this.request({\n service: 'hydra',\n resource: 'teams/',\n qs: options,\n }).then((res) => new Page(res, this.webex));\n },\n\n /**\n * Update a team.\n * @instance\n * @param {TeamObject} team\n * @returns {Promise<TeamObject>}\n * @memberof Teams\n * @example\n * var teams;\n * webex.teams.create({name: 'Update Team Example'})\n * .then(function(r) {\n * teams = r;\n * teams.name = 'Teams Example (Updated Title)';\n * return webex.teams.update(teams);\n * })\n * .then(function() {\n * return webex.teams.get(teams.id);\n * })\n * .then(function(teams) {\n * var assert = require('assert');\n * assert.equal(teams.name, 'Teams Example (Updated Title)');\n * return 'success';\n * });\n * // => success\n\n */\n update(team) {\n const {id} = team;\n\n return this.request({\n method: 'PUT',\n service: 'hydra',\n resource: `teams/${id}`,\n body: team,\n }).then((res) => res.body);\n },\n});\n\nexport default Teams;\n"],"mappings":";;;;;;;;;;AAIA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAMA,KAAK,GAAGC,sBAAA,CAAYC,MAAZ,CAAmB;EAC/B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,MAlB+B,kBAkBxBC,IAlBwB,EAkBlB;IACX,OAAO,KAAKC,OAAL,CAAa;MAClBC,MAAM,EAAE,MADU;MAElBC,OAAO,EAAE,OAFS;MAGlBC,QAAQ,EAAE,OAHQ;MAIlBC,IAAI,EAAEL;IAJY,CAAb,EAKJM,IALI,CAKC,UAACC,GAAD;MAAA,OAASA,GAAG,CAACF,IAAb;IAAA,CALD,CAAP;EAMD,CAzB8B;;EA2B/B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEG,GAhD+B,eAgD3BR,IAhD2B,EAgDrBS,OAhDqB,EAgDZ;IACjB,IAAMC,EAAE,GAAGV,IAAI,CAACU,EAAL,IAAWV,IAAtB;IAEA,OAAO,KAAKC,OAAL,CAAa;MAClBE,OAAO,EAAE,OADS;MAElBC,QAAQ,kBAAWM,EAAX,CAFU;MAGlBC,EAAE,EAAEF;IAHc,CAAb,EAIJH,IAJI,CAIC,UAACC,GAAD;MAAA,OAASA,GAAG,CAACF,IAAJ,CAASO,KAAT,IAAkBL,GAAG,CAACF,IAA/B;IAAA,CAJD,CAAP;EAKD,CAxD8B;;EA0D/B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEQ,IAzF+B,gBAyF1BJ,OAzF0B,EAyFjB;IAAA;;IACZ,OAAO,KAAKR,OAAL,CAAa;MAClBE,OAAO,EAAE,OADS;MAElBC,QAAQ,EAAE,QAFQ;MAGlBO,EAAE,EAAEF;IAHc,CAAb,EAIJH,IAJI,CAIC,UAACC,GAAD;MAAA,OAAS,IAAIO,eAAJ,CAASP,GAAT,EAAc,KAAI,CAACQ,KAAnB,CAAT;IAAA,CAJD,CAAP;EAKD,CA/F8B;;EAiG/B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAEEC,MA1H+B,kBA0HxBhB,IA1HwB,EA0HlB;IACX,IAAOU,EAAP,GAAaV,IAAb,CAAOU,EAAP;IAEA,OAAO,KAAKT,OAAL,CAAa;MAClBC,MAAM,EAAE,KADU;MAElBC,OAAO,EAAE,OAFS;MAGlBC,QAAQ,kBAAWM,EAAX,CAHU;MAIlBL,IAAI,EAAEL;IAJY,CAAb,EAKJM,IALI,CAKC,UAACC,GAAD;MAAA,OAASA,GAAG,CAACF,IAAb;IAAA,CALD,CAAP;EAMD,CAnI8B;EAAA;AAAA,CAAnB,CAAd;;eAsIeT,K"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/plugin-teams",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.15",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"sinon": "^9.2.4"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@webex/internal-plugin-device": "3.0.0-beta.
|
|
27
|
-
"@webex/plugin-logger": "3.0.0-beta.
|
|
28
|
-
"@webex/plugin-memberships": "3.0.0-beta.
|
|
29
|
-
"@webex/plugin-rooms": "3.0.0-beta.
|
|
30
|
-
"@webex/plugin-teams": "3.0.0-beta.
|
|
31
|
-
"@webex/test-helper-chai": "3.0.0-beta.
|
|
32
|
-
"@webex/test-helper-test-users": "3.0.0-beta.
|
|
33
|
-
"@webex/webex-core": "3.0.0-beta.
|
|
26
|
+
"@webex/internal-plugin-device": "3.0.0-beta.15",
|
|
27
|
+
"@webex/plugin-logger": "3.0.0-beta.15",
|
|
28
|
+
"@webex/plugin-memberships": "3.0.0-beta.15",
|
|
29
|
+
"@webex/plugin-rooms": "3.0.0-beta.15",
|
|
30
|
+
"@webex/plugin-teams": "3.0.0-beta.15",
|
|
31
|
+
"@webex/test-helper-chai": "3.0.0-beta.15",
|
|
32
|
+
"@webex/test-helper-test-users": "3.0.0-beta.15",
|
|
33
|
+
"@webex/webex-core": "3.0.0-beta.15",
|
|
34
34
|
"lodash": "^4.17.21"
|
|
35
35
|
}
|
|
36
36
|
}
|
package/src/teams.js
CHANGED
|
@@ -13,7 +13,7 @@ import {WebexPlugin, Page} from '@webex/webex-core';
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* @class
|
|
16
|
+
* @class
|
|
17
17
|
*/
|
|
18
18
|
const Teams = WebexPlugin.extend({
|
|
19
19
|
/**
|
|
@@ -38,9 +38,8 @@ const Teams = WebexPlugin.extend({
|
|
|
38
38
|
method: 'POST',
|
|
39
39
|
service: 'hydra',
|
|
40
40
|
resource: 'teams',
|
|
41
|
-
body: team
|
|
42
|
-
})
|
|
43
|
-
.then((res) => res.body);
|
|
41
|
+
body: team,
|
|
42
|
+
}).then((res) => res.body);
|
|
44
43
|
},
|
|
45
44
|
|
|
46
45
|
/**
|
|
@@ -70,9 +69,8 @@ const Teams = WebexPlugin.extend({
|
|
|
70
69
|
return this.request({
|
|
71
70
|
service: 'hydra',
|
|
72
71
|
resource: `teams/${id}`,
|
|
73
|
-
qs: options
|
|
74
|
-
})
|
|
75
|
-
.then((res) => res.body.items || res.body);
|
|
72
|
+
qs: options,
|
|
73
|
+
}).then((res) => res.body.items || res.body);
|
|
76
74
|
},
|
|
77
75
|
|
|
78
76
|
/**
|
|
@@ -110,9 +108,8 @@ const Teams = WebexPlugin.extend({
|
|
|
110
108
|
return this.request({
|
|
111
109
|
service: 'hydra',
|
|
112
110
|
resource: 'teams/',
|
|
113
|
-
qs: options
|
|
114
|
-
})
|
|
115
|
-
.then((res) => new Page(res, this.webex));
|
|
111
|
+
qs: options,
|
|
112
|
+
}).then((res) => new Page(res, this.webex));
|
|
116
113
|
},
|
|
117
114
|
|
|
118
115
|
/**
|
|
@@ -147,10 +144,9 @@ const Teams = WebexPlugin.extend({
|
|
|
147
144
|
method: 'PUT',
|
|
148
145
|
service: 'hydra',
|
|
149
146
|
resource: `teams/${id}`,
|
|
150
|
-
body: team
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
}
|
|
147
|
+
body: team,
|
|
148
|
+
}).then((res) => res.body);
|
|
149
|
+
},
|
|
154
150
|
});
|
|
155
151
|
|
|
156
152
|
export default Teams;
|
|
@@ -18,30 +18,34 @@ describe('plugin-teams', function () {
|
|
|
18
18
|
|
|
19
19
|
let webex, user;
|
|
20
20
|
|
|
21
|
-
before(() =>
|
|
22
|
-
.then(([u]) => {
|
|
21
|
+
before(() =>
|
|
22
|
+
testUsers.create({count: 1}).then(([u]) => {
|
|
23
23
|
user = u;
|
|
24
24
|
webex = new WebexCore({credentials: user.token});
|
|
25
|
-
})
|
|
25
|
+
})
|
|
26
|
+
);
|
|
26
27
|
|
|
27
28
|
describe('#teams', () => {
|
|
28
29
|
describe('#create()', () => {
|
|
29
|
-
it('creates a team', () =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
it('creates a team', () =>
|
|
31
|
+
webex.teams
|
|
32
|
+
.create({
|
|
33
|
+
name: 'Webex Test Team (create)',
|
|
34
|
+
})
|
|
35
|
+
.then((team) => assert.isTeam(team)));
|
|
33
36
|
});
|
|
34
37
|
|
|
35
38
|
describe('#get()', () => {
|
|
36
|
-
it('retrieves a specific team', () =>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
it('retrieves a specific team', () =>
|
|
40
|
+
webex.teams
|
|
41
|
+
.create({
|
|
42
|
+
name: 'Webex Test Team (get)',
|
|
43
|
+
})
|
|
44
|
+
.then((team) => {
|
|
45
|
+
assert.isTeam(team);
|
|
46
|
+
|
|
47
|
+
return webex.teams.get({id: team.id}).then((result) => assert.deepEqual(result, team));
|
|
48
|
+
}));
|
|
45
49
|
});
|
|
46
50
|
|
|
47
51
|
describe('#list()', () => {
|
|
@@ -49,26 +53,28 @@ describe('plugin-teams', function () {
|
|
|
49
53
|
// the tests rely on ordering.
|
|
50
54
|
let team0, team1;
|
|
51
55
|
|
|
52
|
-
before(() =>
|
|
53
|
-
.then((team) => {
|
|
56
|
+
before(() =>
|
|
57
|
+
webex.teams.create({name: 'Webex Test Team 1'}).then((team) => {
|
|
54
58
|
team1 = team;
|
|
55
|
-
})
|
|
59
|
+
})
|
|
60
|
+
);
|
|
56
61
|
|
|
57
|
-
before(() =>
|
|
58
|
-
.then((team) => {
|
|
62
|
+
before(() =>
|
|
63
|
+
webex.teams.create({name: 'Webex Test Team 0'}).then((team) => {
|
|
59
64
|
team0 = team;
|
|
60
|
-
})
|
|
65
|
+
})
|
|
66
|
+
);
|
|
61
67
|
|
|
62
|
-
it('lists all of the teams to which I have access', () =>
|
|
63
|
-
.then((teams) => {
|
|
68
|
+
it('lists all of the teams to which I have access', () =>
|
|
69
|
+
webex.teams.list().then((teams) => {
|
|
64
70
|
assert.isAbove(teams.length, 1);
|
|
65
71
|
for (const team of teams) {
|
|
66
72
|
assert.isTeam(team);
|
|
67
73
|
}
|
|
68
74
|
}));
|
|
69
75
|
|
|
70
|
-
it('lists a bounded, pageable set of teams to which I have access', () =>
|
|
71
|
-
.then((teams) => {
|
|
76
|
+
it('lists a bounded, pageable set of teams to which I have access', () =>
|
|
77
|
+
webex.teams.list({max: 1}).then((teams) => {
|
|
72
78
|
assert.lengthOf(teams, 1);
|
|
73
79
|
const spy = sinon.spy();
|
|
74
80
|
|
|
@@ -82,108 +88,122 @@ describe('plugin-teams', function () {
|
|
|
82
88
|
}
|
|
83
89
|
|
|
84
90
|
return Promise.resolve();
|
|
85
|
-
}(teams))
|
|
86
|
-
.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
});
|
|
91
|
+
})(teams).then(() => {
|
|
92
|
+
assert.isAbove(spy.callCount, 1);
|
|
93
|
+
assert.calledWith(spy, team0.id);
|
|
94
|
+
assert.calledWith(spy, team1.id);
|
|
95
|
+
});
|
|
91
96
|
}));
|
|
92
97
|
});
|
|
93
98
|
|
|
94
99
|
describe('#update()', () => {
|
|
95
|
-
it(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
it("updates a single team's name", () =>
|
|
101
|
+
webex.teams
|
|
102
|
+
.create({
|
|
103
|
+
name: 'Webex Test Team',
|
|
104
|
+
})
|
|
105
|
+
.then((team) => {
|
|
106
|
+
assert.isTeam(team);
|
|
100
107
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
return webex.teams.update(Object.assign({}, team, {name: 'Webex Test Team (Updated)'}));
|
|
109
|
+
})
|
|
110
|
+
.then((team) => {
|
|
111
|
+
assert.isTeam(team);
|
|
112
|
+
assert.equal(team.name, 'Webex Test Team (Updated)');
|
|
113
|
+
}));
|
|
107
114
|
});
|
|
108
115
|
});
|
|
109
116
|
|
|
110
117
|
describe('#rooms', () => {
|
|
111
118
|
let team;
|
|
112
119
|
|
|
113
|
-
before(() =>
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
120
|
+
before(() =>
|
|
121
|
+
webex.teams
|
|
122
|
+
.create({
|
|
123
|
+
name: 'Webex Test Team',
|
|
124
|
+
})
|
|
125
|
+
.then((t) => {
|
|
126
|
+
team = t;
|
|
127
|
+
})
|
|
128
|
+
);
|
|
117
129
|
|
|
118
130
|
describe('#create()', () => {
|
|
119
131
|
// COLLAB-1104 create date don't match; Mike is working on a fix
|
|
120
|
-
it.skip('creates a room that is part of a team', () =>
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
132
|
+
it.skip('creates a room that is part of a team', () =>
|
|
133
|
+
webex.rooms
|
|
134
|
+
.create({
|
|
135
|
+
title: 'Team Room',
|
|
136
|
+
teamId: team.id,
|
|
137
|
+
})
|
|
138
|
+
.then((room) => {
|
|
139
|
+
assert.isTeamRoom(room);
|
|
140
|
+
assert.equal(room.teamId, team.id);
|
|
141
|
+
}));
|
|
128
142
|
});
|
|
129
143
|
|
|
130
144
|
describe('#get()', () => {
|
|
131
|
-
it('retrieves a specific room that is part of a team', () =>
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
.then((room) => {
|
|
137
|
-
assert.isTeamRoom(room);
|
|
138
|
-
assert.equal(room.teamId, team.id);
|
|
139
|
-
}));
|
|
140
|
-
|
|
141
|
-
describe('when the user leaves the team\'s general room', () => {
|
|
142
|
-
let room, team;
|
|
143
|
-
|
|
144
|
-
it('no longer returns the team\'s rooms', () => webex.teams.create({
|
|
145
|
-
name: 'Team Title'
|
|
146
|
-
})
|
|
147
|
-
.then((t) => {
|
|
148
|
-
team = t;
|
|
149
|
-
|
|
150
|
-
return webex.rooms.create({
|
|
151
|
-
title: 'Room Title',
|
|
152
|
-
teamId: team.id
|
|
153
|
-
});
|
|
145
|
+
it('retrieves a specific room that is part of a team', () =>
|
|
146
|
+
webex.rooms
|
|
147
|
+
.create({
|
|
148
|
+
title: 'Team Room',
|
|
149
|
+
teamId: team.id,
|
|
154
150
|
})
|
|
155
|
-
.then((
|
|
156
|
-
|
|
151
|
+
.then((room) => webex.rooms.get(room))
|
|
152
|
+
.then((room) => {
|
|
153
|
+
assert.isTeamRoom(room);
|
|
154
|
+
assert.equal(room.teamId, team.id);
|
|
155
|
+
}));
|
|
157
156
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
.then((teamRooms) => {
|
|
161
|
-
assert.lengthOf(teamRooms, 2);
|
|
162
|
-
const generalRoom = find(teamRooms.items, (r) => r.id !== room.id);
|
|
157
|
+
describe("when the user leaves the team's general room", () => {
|
|
158
|
+
let room, team;
|
|
163
159
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
160
|
+
it("no longer returns the team's rooms", () =>
|
|
161
|
+
webex.teams
|
|
162
|
+
.create({
|
|
163
|
+
name: 'Team Title',
|
|
164
|
+
})
|
|
165
|
+
.then((t) => {
|
|
166
|
+
team = t;
|
|
167
|
+
|
|
168
|
+
return webex.rooms.create({
|
|
169
|
+
title: 'Room Title',
|
|
170
|
+
teamId: team.id,
|
|
171
|
+
});
|
|
172
|
+
})
|
|
173
|
+
.then((r) => {
|
|
174
|
+
room = r;
|
|
175
|
+
|
|
176
|
+
return webex.rooms.list({teamId: team.id});
|
|
177
|
+
})
|
|
178
|
+
.then((teamRooms) => {
|
|
179
|
+
assert.lengthOf(teamRooms, 2);
|
|
180
|
+
const generalRoom = find(teamRooms.items, (r) => r.id !== room.id);
|
|
181
|
+
|
|
182
|
+
return webex.memberships.list({roomId: generalRoom.id, personId: user.id});
|
|
183
|
+
})
|
|
184
|
+
.then((memberships) => webex.memberships.remove(memberships.items[0]))
|
|
185
|
+
.then(() => assert.isRejected(webex.rooms.get(room)))
|
|
186
|
+
.then((reason) => {
|
|
187
|
+
assert.instanceOf(reason, WebexHttpError.NotFound);
|
|
188
|
+
}));
|
|
171
189
|
});
|
|
172
190
|
});
|
|
173
191
|
|
|
174
192
|
describe('#list()', () => {
|
|
175
|
-
it('lists all rooms in a team', () =>
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
assert.
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
193
|
+
it('lists all rooms in a team', () =>
|
|
194
|
+
webex.rooms
|
|
195
|
+
.create({
|
|
196
|
+
title: 'Team Room',
|
|
197
|
+
teamId: team.id,
|
|
198
|
+
})
|
|
199
|
+
.then(() => webex.rooms.list({teamId: team.id}))
|
|
200
|
+
.then((rooms) => {
|
|
201
|
+
assert.isAbove(rooms.length, 0);
|
|
202
|
+
for (const room of rooms) {
|
|
203
|
+
assert.isTeamRoom(room);
|
|
204
|
+
assert.equal(room.teamId, team.id);
|
|
205
|
+
}
|
|
206
|
+
}));
|
|
187
207
|
});
|
|
188
208
|
});
|
|
189
209
|
});
|