@webex/plugin-teams 3.0.0-beta.8 → 3.0.0-bnr.0
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/index.js +1 -6
- package/dist/index.js.map +1 -1
- package/dist/plugin-teams.d.ts +7 -0
- package/dist/teams.js +2 -11
- package/dist/teams.js.map +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/teams.d.ts +27 -0
- 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/index.js
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
|
|
11
8
|
exports.default = void 0;
|
|
12
|
-
|
|
13
9
|
var _webexCore = require("@webex/webex-core");
|
|
14
|
-
|
|
15
10
|
var _teams = _interopRequireDefault(require("./teams"));
|
|
16
|
-
|
|
17
11
|
/*!
|
|
18
12
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
19
13
|
*/
|
|
14
|
+
|
|
20
15
|
(0, _webexCore.registerPlugin)('teams', _teams.default);
|
|
21
16
|
var _default = _teams.default;
|
|
22
17
|
exports.default = _default;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["registerPlugin","Teams"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {registerPlugin} from '@webex/webex-core';\n\nimport Teams from './teams';\n\nregisterPlugin('teams', Teams);\n\nexport default Teams;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["registerPlugin","Teams"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {registerPlugin} from '@webex/webex-core';\n\nimport Teams from './teams';\n\nregisterPlugin('teams', Teams);\n\nexport default Teams;\n"],"mappings":";;;;;;;;AAIA;AAEA;AANA;AACA;AACA;;AAMA,IAAAA,yBAAc,EAAC,OAAO,EAAEC,cAAK,CAAC;AAAC,eAEhBA,cAAK;AAAA"}
|
package/dist/teams.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
|
|
9
7
|
exports.default = void 0;
|
|
10
|
-
|
|
11
8
|
var _webexCore = require("@webex/webex-core");
|
|
12
|
-
|
|
13
9
|
/*!
|
|
14
10
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
15
11
|
*/
|
|
@@ -23,7 +19,7 @@ var _webexCore = require("@webex/webex-core");
|
|
|
23
19
|
*/
|
|
24
20
|
|
|
25
21
|
/**
|
|
26
|
-
* @class
|
|
22
|
+
* @class
|
|
27
23
|
*/
|
|
28
24
|
var Teams = _webexCore.WebexPlugin.extend({
|
|
29
25
|
/**
|
|
@@ -53,7 +49,6 @@ var Teams = _webexCore.WebexPlugin.extend({
|
|
|
53
49
|
return res.body;
|
|
54
50
|
});
|
|
55
51
|
},
|
|
56
|
-
|
|
57
52
|
/**
|
|
58
53
|
* Returns a single team
|
|
59
54
|
* @instance
|
|
@@ -85,7 +80,6 @@ var Teams = _webexCore.WebexPlugin.extend({
|
|
|
85
80
|
return res.body.items || res.body;
|
|
86
81
|
});
|
|
87
82
|
},
|
|
88
|
-
|
|
89
83
|
/**
|
|
90
84
|
* List teams.
|
|
91
85
|
* @instance
|
|
@@ -119,7 +113,6 @@ var Teams = _webexCore.WebexPlugin.extend({
|
|
|
119
113
|
*/
|
|
120
114
|
list: function list(options) {
|
|
121
115
|
var _this = this;
|
|
122
|
-
|
|
123
116
|
return this.request({
|
|
124
117
|
service: 'hydra',
|
|
125
118
|
resource: 'teams/',
|
|
@@ -128,7 +121,6 @@ var Teams = _webexCore.WebexPlugin.extend({
|
|
|
128
121
|
return new _webexCore.Page(res, _this.webex);
|
|
129
122
|
});
|
|
130
123
|
},
|
|
131
|
-
|
|
132
124
|
/**
|
|
133
125
|
* Update a team.
|
|
134
126
|
* @instance
|
|
@@ -164,9 +156,8 @@ var Teams = _webexCore.WebexPlugin.extend({
|
|
|
164
156
|
return res.body;
|
|
165
157
|
});
|
|
166
158
|
},
|
|
167
|
-
version: "3.0.0-
|
|
159
|
+
version: "3.0.0-bnr.0"
|
|
168
160
|
});
|
|
169
|
-
|
|
170
161
|
var _default = Teams;
|
|
171
162
|
exports.default = _default;
|
|
172
163
|
//# sourceMappingURL=teams.js.map
|
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,sBAAW,CAACC,MAAM,CAAC;EAC/B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,MAAM,kBAACC,IAAI,EAAE;IACX,OAAO,IAAI,CAACC,OAAO,CAAC;MAClBC,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE,OAAO;MAChBC,QAAQ,EAAE,OAAO;MACjBC,IAAI,EAAEL;IACR,CAAC,CAAC,CAACM,IAAI,CAAC,UAACC,GAAG;MAAA,OAAKA,GAAG,CAACF,IAAI;IAAA,EAAC;EAC5B,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEG,GAAG,eAACR,IAAI,EAAES,OAAO,EAAE;IACjB,IAAMC,EAAE,GAAGV,IAAI,CAACU,EAAE,IAAIV,IAAI;IAE1B,OAAO,IAAI,CAACC,OAAO,CAAC;MAClBE,OAAO,EAAE,OAAO;MAChBC,QAAQ,kBAAWM,EAAE,CAAE;MACvBC,EAAE,EAAEF;IACN,CAAC,CAAC,CAACH,IAAI,CAAC,UAACC,GAAG;MAAA,OAAKA,GAAG,CAACF,IAAI,CAACO,KAAK,IAAIL,GAAG,CAACF,IAAI;IAAA,EAAC;EAC9C,CAAC;EAED;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,IAAI,gBAACJ,OAAO,EAAE;IAAA;IACZ,OAAO,IAAI,CAACR,OAAO,CAAC;MAClBE,OAAO,EAAE,OAAO;MAChBC,QAAQ,EAAE,QAAQ;MAClBO,EAAE,EAAEF;IACN,CAAC,CAAC,CAACH,IAAI,CAAC,UAACC,GAAG;MAAA,OAAK,IAAIO,eAAI,CAACP,GAAG,EAAE,KAAI,CAACQ,KAAK,CAAC;IAAA,EAAC;EAC7C,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAEEC,MAAM,kBAAChB,IAAI,EAAE;IACX,IAAOU,EAAE,GAAIV,IAAI,CAAVU,EAAE;IAET,OAAO,IAAI,CAACT,OAAO,CAAC;MAClBC,MAAM,EAAE,KAAK;MACbC,OAAO,EAAE,OAAO;MAChBC,QAAQ,kBAAWM,EAAE,CAAE;MACvBL,IAAI,EAAEL;IACR,CAAC,CAAC,CAACM,IAAI,CAAC,UAACC,GAAG;MAAA,OAAKA,GAAG,CAACF,IAAI;IAAA,EAAC;EAC5B,CAAC;EAAA;AACH,CAAC,CAAC;AAAC,eAEYT,KAAK;AAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.34.4"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default Teams;
|
|
2
|
+
export type TeamObject = {
|
|
3
|
+
/**
|
|
4
|
+
* - (server generated) Unique identifier for the team
|
|
5
|
+
*/
|
|
6
|
+
id: string;
|
|
7
|
+
/**
|
|
8
|
+
* - The name of the team
|
|
9
|
+
*/
|
|
10
|
+
name: string;
|
|
11
|
+
/**
|
|
12
|
+
* - (server generated) The date and time that the
|
|
13
|
+
* team was created
|
|
14
|
+
*/
|
|
15
|
+
created: isoDate;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* @typedef {Object} TeamObject
|
|
19
|
+
* @property {string} id - (server generated) Unique identifier for the team
|
|
20
|
+
* @property {string} name - The name of the team
|
|
21
|
+
* @property {isoDate} created - (server generated) The date and time that the
|
|
22
|
+
* team was created
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* @class
|
|
26
|
+
*/
|
|
27
|
+
declare const Teams: any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/plugin-teams",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-bnr.0",
|
|
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-
|
|
27
|
-
"@webex/plugin-logger": "3.0.0-
|
|
28
|
-
"@webex/plugin-memberships": "3.0.0-
|
|
29
|
-
"@webex/plugin-rooms": "3.0.0-
|
|
30
|
-
"@webex/plugin-teams": "3.0.0-
|
|
31
|
-
"@webex/test-helper-chai": "3.0.0-
|
|
32
|
-
"@webex/test-helper-test-users": "3.0.0-
|
|
33
|
-
"@webex/webex-core": "3.0.0-
|
|
26
|
+
"@webex/internal-plugin-device": "3.0.0-bnr.0",
|
|
27
|
+
"@webex/plugin-logger": "3.0.0-bnr.0",
|
|
28
|
+
"@webex/plugin-memberships": "3.0.0-bnr.0",
|
|
29
|
+
"@webex/plugin-rooms": "3.0.0-bnr.0",
|
|
30
|
+
"@webex/plugin-teams": "3.0.0-bnr.0",
|
|
31
|
+
"@webex/test-helper-chai": "3.0.0-bnr.0",
|
|
32
|
+
"@webex/test-helper-test-users": "3.0.0-bnr.0",
|
|
33
|
+
"@webex/webex-core": "3.0.0-bnr.0",
|
|
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
|
});
|