@webex/internal-plugin-presence 3.0.0-beta.9 → 3.0.0-beta.90

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/src/presence.js CHANGED
@@ -21,7 +21,7 @@ const Presence = WebexPlugin.extend({
21
21
  namespace: 'Presence',
22
22
 
23
23
  children: {
24
- batcher: PresenceBatcher
24
+ batcher: PresenceBatcher,
25
25
  },
26
26
 
27
27
  session: {
@@ -29,8 +29,8 @@ const Presence = WebexPlugin.extend({
29
29
  default() {
30
30
  return new PresenceWorker();
31
31
  },
32
- type: 'any'
33
- }
32
+ type: 'any',
33
+ },
34
34
  },
35
35
 
36
36
  /**
@@ -62,7 +62,8 @@ const Presence = WebexPlugin.extend({
62
62
  * @returns {Promise<boolean>} resolves with true, if successful
63
63
  */
64
64
  enable() {
65
- return this.webex.internal.feature.setFeature(USER, USER_PRESENCE_ENABLED, true)
65
+ return this.webex.internal.feature
66
+ .setFeature(USER, USER_PRESENCE_ENABLED, true)
66
67
  .then((response) => response.value);
67
68
  },
68
69
 
@@ -71,7 +72,8 @@ const Presence = WebexPlugin.extend({
71
72
  * @returns {Promise<boolean>} resolves with false, if successful
72
73
  */
73
74
  disable() {
74
- return this.webex.internal.feature.setFeature(USER, USER_PRESENCE_ENABLED, false)
75
+ return this.webex.internal.feature
76
+ .setFeature(USER, USER_PRESENCE_ENABLED, false)
75
77
  .then((response) => response.value);
76
78
  },
77
79
 
@@ -113,17 +115,18 @@ const Presence = WebexPlugin.extend({
113
115
  return Promise.reject(new Error('A person id is required'));
114
116
  }
115
117
 
116
- return this.webex.request({
117
- method: 'GET',
118
- service: 'apheleia',
119
- resource: `compositions?userId=${personId}`
120
- })
118
+ return this.webex
119
+ .request({
120
+ method: 'GET',
121
+ service: 'apheleia',
122
+ resource: `compositions?userId=${personId}`,
123
+ })
121
124
  .then((response) => response.body);
122
125
  },
123
126
 
124
127
  /**
125
- * @typedef {Object} PresenceStatusesObject
126
- * @property {Array.<PresenceStatusObject>} statusList
128
+ * @typedef {Object} PresenceStatusesObject
129
+ * @property {Array.<PresenceStatusObject>} statusList
127
130
  */
128
131
  /**
129
132
  * Gets the current presence statuses of an array of people ids
@@ -135,9 +138,9 @@ const Presence = WebexPlugin.extend({
135
138
  return Promise.reject(new Error('An array of person ids is required'));
136
139
  }
137
140
 
138
- return Promise.all(personIds.map((id) =>
139
- this.batcher.request(id)))
140
- .then((presences) => ({statusList: presences}));
141
+ return Promise.all(personIds.map((id) => this.batcher.request(id))).then((presences) => ({
142
+ statusList: presences,
143
+ }));
141
144
  },
142
145
 
143
146
  /**
@@ -157,8 +160,7 @@ const Presence = WebexPlugin.extend({
157
160
  }
158
161
  if (Array.isArray(personIds)) {
159
162
  subjects = personIds;
160
- }
161
- else {
163
+ } else {
162
164
  subjects = [personIds];
163
165
  }
164
166
  // Limit batches to 50 ids per request
@@ -166,19 +168,22 @@ const Presence = WebexPlugin.extend({
166
168
  batches.push(subjects.slice(i, i + batchLimit));
167
169
  }
168
170
 
169
- return Promise.all(batches.map((ids) =>
170
- this.webex.request({
171
- method: 'POST',
172
- api: 'apheleia',
173
- resource: 'subscriptions',
174
- body: {
175
- subjects: ids,
176
- subscriptionTtl,
177
- includeStatus: true
178
- }
179
- })
180
- .then((response) => response.body.responses)))
181
- .then((idBatches) => ({responses: [].concat(...idBatches)}));
171
+ return Promise.all(
172
+ batches.map((ids) =>
173
+ this.webex
174
+ .request({
175
+ method: 'POST',
176
+ api: 'apheleia',
177
+ resource: 'subscriptions',
178
+ body: {
179
+ subjects: ids,
180
+ subscriptionTtl,
181
+ includeStatus: true,
182
+ },
183
+ })
184
+ .then((response) => response.body.responses)
185
+ )
186
+ ).then((idBatches) => ({responses: [].concat(...idBatches)}));
182
187
  },
183
188
 
184
189
  /**
@@ -194,8 +199,7 @@ const Presence = WebexPlugin.extend({
194
199
  }
195
200
  if (Array.isArray(personIds)) {
196
201
  subjects = personIds;
197
- }
198
- else {
202
+ } else {
199
203
  subjects = [personIds];
200
204
  }
201
205
 
@@ -206,8 +210,8 @@ const Presence = WebexPlugin.extend({
206
210
  body: {
207
211
  subjects,
208
212
  subscriptionTtl: 0,
209
- includeStatus: true
210
- }
213
+ includeStatus: true,
214
+ },
211
215
  });
212
216
  },
213
217
 
@@ -222,16 +226,17 @@ const Presence = WebexPlugin.extend({
222
226
  return Promise.reject(new Error('A status is required'));
223
227
  }
224
228
 
225
- return this.webex.request({
226
- method: 'POST',
227
- api: 'apheleia',
228
- resource: 'events',
229
- body: {
230
- subject: this.webex.internal.device.userId,
231
- eventType: status,
232
- ttl
233
- }
234
- })
229
+ return this.webex
230
+ .request({
231
+ method: 'POST',
232
+ api: 'apheleia',
233
+ resource: 'events',
234
+ body: {
235
+ subject: this.webex.internal.device.userId,
236
+ eventType: status,
237
+ ttl,
238
+ },
239
+ })
235
240
  .then((response) => response.body);
236
241
  },
237
242
 
@@ -251,7 +256,7 @@ const Presence = WebexPlugin.extend({
251
256
  */
252
257
  dequeue(id) {
253
258
  return this.worker.dequeue(id);
254
- }
259
+ },
255
260
  });
256
261
 
257
262
  export default Presence;
@@ -16,77 +16,85 @@ describe('plugin-presence', function () {
16
16
  describe('Presence', () => {
17
17
  let mccoy, spock;
18
18
 
19
- beforeEach('create users', () => testUsers.create({count: 2})
20
- .then((users) => {
19
+ beforeEach('create users', () =>
20
+ testUsers.create({count: 2}).then((users) => {
21
21
  [spock, mccoy] = users;
22
22
  spock.webex = new WebexCore({
23
23
  credentials: {
24
- authorization: users[0].token
25
- }
24
+ authorization: users[0].token,
25
+ },
26
26
  });
27
27
  mccoy.webex = new WebexCore({
28
28
  credentials: {
29
- authorization: users[1].token
30
- }
29
+ authorization: users[1].token,
30
+ },
31
31
  });
32
- }));
32
+ })
33
+ );
33
34
 
34
- beforeEach('register with wdm', () => Promise.all([
35
- spock.webex.internal.device.register(),
36
- mccoy.webex.internal.device.register()
37
- ]));
35
+ beforeEach('register with wdm', () =>
36
+ Promise.all([spock.webex.internal.device.register(), mccoy.webex.internal.device.register()])
37
+ );
38
38
 
39
39
  beforeEach('register spock with mercury', () => spock.webex.internal.mercury.connect());
40
40
 
41
41
  afterEach('deregister spock with mercury', () => spock.webex.internal.mercury.disconnect());
42
42
 
43
43
  describe('#enable()', () => {
44
- it('enables presence', () => spock.webex.internal.presence.enable()
45
- .then((isEnabled) => {
46
- assert.equal(isEnabled, true);
47
- })
48
- .then(() => spock.webex.internal.presence.isEnabled())
49
- .then((isEnabled) => {
50
- assert.equal(isEnabled, true);
51
- }));
44
+ it('enables presence', () =>
45
+ spock.webex.internal.presence
46
+ .enable()
47
+ .then((isEnabled) => {
48
+ assert.equal(isEnabled, true);
49
+ })
50
+ .then(() => spock.webex.internal.presence.isEnabled())
51
+ .then((isEnabled) => {
52
+ assert.equal(isEnabled, true);
53
+ }));
52
54
  });
53
55
 
54
56
  describe('#disable()', () => {
55
- it('disables presence', () => spock.webex.internal.presence.disable()
56
- .then((isEnabled) => {
57
- assert.equal(isEnabled, false);
58
- })
59
- .then(() => spock.webex.internal.presence.isEnabled())
60
- .then((isEnabled) => {
61
- assert.equal(isEnabled, false);
62
- }));
57
+ it('disables presence', () =>
58
+ spock.webex.internal.presence
59
+ .disable()
60
+ .then((isEnabled) => {
61
+ assert.equal(isEnabled, false);
62
+ })
63
+ .then(() => spock.webex.internal.presence.isEnabled())
64
+ .then((isEnabled) => {
65
+ assert.equal(isEnabled, false);
66
+ }));
63
67
  });
64
68
 
65
69
  describe('#isEnabled()', () => {
66
- it('returns true when presence is enabled', () => spock.webex.internal.presence.enable()
67
- .then(() => spock.webex.internal.presence.isEnabled())
68
- .then((isEnabled) => {
69
- assert.equal(isEnabled, true);
70
- }));
70
+ it('returns true when presence is enabled', () =>
71
+ spock.webex.internal.presence
72
+ .enable()
73
+ .then(() => spock.webex.internal.presence.isEnabled())
74
+ .then((isEnabled) => {
75
+ assert.equal(isEnabled, true);
76
+ }));
71
77
 
72
- it('returns false when presence is disabled', () => spock.webex.internal.presence.disable()
73
- .then(() => spock.webex.internal.presence.isEnabled())
74
- .then((isEnabled) => {
75
- assert.equal(isEnabled, false);
76
- }));
78
+ it('returns false when presence is disabled', () =>
79
+ spock.webex.internal.presence
80
+ .disable()
81
+ .then(() => spock.webex.internal.presence.isEnabled())
82
+ .then((isEnabled) => {
83
+ assert.equal(isEnabled, false);
84
+ }));
77
85
  });
78
86
 
79
87
  describe('#get()', () => {
80
- it('gets a person\'s status by id', () => spock.webex.internal.presence.get(mccoy.id)
81
- .then((presenceResponse) => {
88
+ it("gets a person's status by id", () =>
89
+ spock.webex.internal.presence.get(mccoy.id).then((presenceResponse) => {
82
90
  assert.property(presenceResponse, 'subject');
83
91
  assert.equal(presenceResponse.subject, mccoy.id);
84
92
  }));
85
93
  });
86
94
 
87
95
  describe('#list()', () => {
88
- it('returns an object with the status of all requested people', () => spock.webex.internal.presence.list([mccoy.id, spock.id])
89
- .then((presenceResponse) => {
96
+ it('returns an object with the status of all requested people', () =>
97
+ spock.webex.internal.presence.list([mccoy.id, spock.id]).then((presenceResponse) => {
90
98
  assert.equal(presenceResponse.statusList.length, 2);
91
99
  assert.property(presenceResponse.statusList[0], 'subject');
92
100
  assert.equal(presenceResponse.statusList[0].subject, mccoy.id);
@@ -97,16 +105,18 @@ describe('plugin-presence', function () {
97
105
  describe('batching of presence requests', () => {
98
106
  let batchTestUsers;
99
107
 
100
- beforeEach('create more users', () => testUsers.create({count: 6})
101
- .then((users) => {
108
+ beforeEach('create more users', () =>
109
+ testUsers.create({count: 6}).then((users) => {
102
110
  batchTestUsers = users;
103
- }));
111
+ })
112
+ );
104
113
 
105
114
  it('executes network requests for max limit', () => {
106
115
  spock.webex.internal.presence.config.batcherMaxCalls = 2;
107
116
  sinon.spy(spock.webex.internal.presence.batcher, 'submitHttpRequest');
108
117
 
109
- return spock.webex.internal.presence.list(batchTestUsers.map((user) => user.id))
118
+ return spock.webex.internal.presence
119
+ .list(batchTestUsers.map((user) => user.id))
110
120
  .then((presenceResponse) => {
111
121
  assert.equal(presenceResponse.statusList.length, 6);
112
122
  assert.calledThrice(spock.webex.internal.presence.batcher.submitHttpRequest);
@@ -117,61 +127,87 @@ describe('plugin-presence', function () {
117
127
  });
118
128
 
119
129
  describe('#subscribe', () => {
120
- afterEach(() => spock && spock.webex && spock.webex.internal.presence.unsubscribe([mccoy.id, spock.id]));
130
+ afterEach(
131
+ () =>
132
+ spock && spock.webex && spock.webex.internal.presence.unsubscribe([mccoy.id, spock.id])
133
+ );
121
134
 
122
- it('subscribes to a person id and returns subscription status', () => spock.webex.internal.presence.subscribe(mccoy.id)
123
- .then((presenceResponse) => {
135
+ it('subscribes to a person id and returns subscription status', () =>
136
+ spock.webex.internal.presence.subscribe(mccoy.id).then((presenceResponse) => {
124
137
  assert.property(presenceResponse, 'responses');
125
138
  assert.equal(presenceResponse.responses.length, 1);
126
139
  assert.equal(presenceResponse.responses[0].subject, mccoy.id);
127
140
  }));
128
141
 
129
142
  it('subscribes and returns subscription status of a list of people ids', () =>
130
- spock.webex.internal.presence.subscribe([mccoy.id, spock.id])
131
- .then((presenceResponse) => {
132
- assert.property(presenceResponse, 'responses');
133
- assert.equal(presenceResponse.responses.length, 2);
134
- assert.equal(presenceResponse.responses[0].subject, mccoy.id);
135
- assert.equal(presenceResponse.responses[1].subject, spock.id);
136
- }));
143
+ spock.webex.internal.presence.subscribe([mccoy.id, spock.id]).then((presenceResponse) => {
144
+ assert.property(presenceResponse, 'responses');
145
+ assert.equal(presenceResponse.responses.length, 2);
146
+ assert.equal(presenceResponse.responses[0].subject, mccoy.id);
147
+ assert.equal(presenceResponse.responses[1].subject, spock.id);
148
+ }));
137
149
 
138
150
  // Note: The presence service no longer accepts setting status to "inactive".
139
151
  // Inactivity is now determined by a "last active time" of greater than 10 minutes.
140
- it('should receive a mercury event for a subscribed person\'s change', () =>
141
- spock.webex.internal.presence.subscribe(mccoy.id)
152
+ it("should receive a mercury event for a subscribed person's change", () =>
153
+ spock.webex.internal.presence
154
+ .subscribe(mccoy.id)
142
155
  // 'active' status
143
- .then(() => Promise.all([
144
- expectEvent(10000, 'event:apheleia.subscription_update', spock.webex.internal.mercury, 'spock should get the presence active event'),
145
- mccoy.webex.internal.presence.setStatus('active', 1500)
146
- ]))
147
- .then(([event]) => assert.equal(event.data.status, 'active', 'mccoy presence event status should be active'))
156
+ .then(() =>
157
+ Promise.all([
158
+ expectEvent(
159
+ 10000,
160
+ 'event:apheleia.subscription_update',
161
+ spock.webex.internal.mercury,
162
+ 'spock should get the presence active event'
163
+ ),
164
+ mccoy.webex.internal.presence.setStatus('active', 1500),
165
+ ])
166
+ )
167
+ .then(([event]) =>
168
+ assert.equal(
169
+ event.data.status,
170
+ 'active',
171
+ 'mccoy presence event status should be active'
172
+ )
173
+ )
148
174
  // 'dnd' status
149
- .then(() => Promise.all([
150
- expectEvent(10000, 'event:apheleia.subscription_update', spock.webex.internal.mercury, 'spock should get the presence dnd event'),
151
- mccoy.webex.internal.presence.setStatus('dnd', 1500)
152
- ]))
153
- .then(([event]) => assert.equal(event.data.status, 'dnd', 'mccoy presence event status should be dnd')));
175
+ .then(() =>
176
+ Promise.all([
177
+ expectEvent(
178
+ 10000,
179
+ 'event:apheleia.subscription_update',
180
+ spock.webex.internal.mercury,
181
+ 'spock should get the presence dnd event'
182
+ ),
183
+ mccoy.webex.internal.presence.setStatus('dnd', 1500),
184
+ ])
185
+ )
186
+ .then(([event]) =>
187
+ assert.equal(event.data.status, 'dnd', 'mccoy presence event status should be dnd')
188
+ ));
154
189
  });
155
190
 
156
191
  describe('#unsubscribe', () => {
157
192
  it('unsubscribes to presence updates of a single person id', () =>
158
- spock.webex.internal.presence.unsubscribe(mccoy.id)
193
+ spock.webex.internal.presence
194
+ .unsubscribe(mccoy.id)
159
195
  .then((res) => assert.statusCode(res, 200)));
160
196
 
161
197
  it('unsubscribes to presence updates of a list of people ids', () =>
162
- spock.webex.internal.presence.unsubscribe([mccoy.id, spock.id])
198
+ spock.webex.internal.presence
199
+ .unsubscribe([mccoy.id, spock.id])
163
200
  .then((res) => assert.statusCode(res, 200)));
164
201
  });
165
202
 
166
203
  describe('#setStatus', () => {
167
204
  it('sets the presence status of the current user', () =>
168
- spock.webex.internal.presence.setStatus('dnd', 1500)
169
- .then((statusResponse) => {
170
- assert.property(statusResponse, 'subject');
171
- assert.property(statusResponse, 'status');
172
- assert.equal(statusResponse.subject, spock.id);
173
- assert.equal(statusResponse.status, 'dnd');
174
- }));
205
+ spock.webex.internal.presence.setStatus('dnd', 1500).then((statusResponse) => {
206
+ assert.property(statusResponse, 'subject');
207
+ assert.property(statusResponse, 'status');
208
+ assert.equal(statusResponse.subject, spock.id);
209
+ assert.equal(statusResponse.status, 'dnd');
210
+ }));
175
211
  });
176
212
  });
177
213
  });
@@ -18,22 +18,18 @@ describe('presence-worker', () => {
18
18
  webex = new MockWebex({
19
19
  children: {
20
20
  mercury: Mercury,
21
- presence: Presence
22
- }
21
+ presence: Presence,
22
+ },
23
23
  });
24
24
  worker = new PresenceWorker();
25
25
  worker.webex = webex;
26
26
  });
27
27
 
28
28
  describe('#initialize()', () => {
29
- it('requires webex', () => assert.throws(
30
- worker.initialize,
31
- /Must initialize Presence Worker with webex!/
32
- ));
33
- it('requires webex internal', () => assert.throws(
34
- () => worker.initialize({}),
35
- /Must initialize Presence Worker with webex!/
36
- ));
29
+ it('requires webex', () =>
30
+ assert.throws(worker.initialize, /Must initialize Presence Worker with webex!/));
31
+ it('requires webex internal', () =>
32
+ assert.throws(() => worker.initialize({}), /Must initialize Presence Worker with webex!/));
37
33
  });
38
34
 
39
35
  describe('#enqueue()', () => {
@@ -119,12 +115,11 @@ describe('presence-worker', () => {
119
115
  const boarding = {
120
116
  pam: true,
121
117
  jim: true,
122
- dwight: true
118
+ dwight: true,
123
119
  };
124
120
 
125
121
  it('moves fetchers to flights', () => {
126
- webex.internal.presence.list = sinon.stub()
127
- .returns(Promise.resolve({statusList: []}));
122
+ webex.internal.presence.list = sinon.stub().returns(Promise.resolve({statusList: []}));
128
123
 
129
124
  worker.fetchers = boarding;
130
125
 
@@ -134,13 +129,10 @@ describe('presence-worker', () => {
134
129
  });
135
130
 
136
131
  it('calls presence.list', async () => {
137
- const response = [
138
- {subject: 'pam'},
139
- {subject: 'jim'},
140
- {subject: 'dwight'}
141
- ];
132
+ const response = [{subject: 'pam'}, {subject: 'jim'}, {subject: 'dwight'}];
142
133
 
143
- webex.internal.presence.list = sinon.stub()
134
+ webex.internal.presence.list = sinon
135
+ .stub()
144
136
  .returns(Promise.resolve({statusList: response}));
145
137
  webex.internal.presence.emitEvent = sinon.stub();
146
138
 
@@ -151,9 +143,10 @@ describe('presence-worker', () => {
151
143
  assert.calledWith(webex.internal.presence.list, Object.keys(boarding));
152
144
  assert.isEmpty(worker.flights);
153
145
  assert.deepEqual(Object.keys(worker.presences), Object.keys(boarding));
154
- assert.calledWith(webex.internal.presence.emitEvent,
155
- 'updated',
156
- {type: 'presence', payload: {statusList: response}});
146
+ assert.calledWith(webex.internal.presence.emitEvent, 'updated', {
147
+ type: 'presence',
148
+ payload: {statusList: response},
149
+ });
157
150
  });
158
151
  });
159
152
 
@@ -163,7 +156,7 @@ describe('presence-worker', () => {
163
156
  const scouts = {
164
157
  pam: now - 60001, // move them back a little over a minute
165
158
  jim: now - 60001,
166
- dwight: now
159
+ dwight: now,
167
160
  };
168
161
 
169
162
  worker.campers = scouts;
@@ -180,11 +173,11 @@ describe('presence-worker', () => {
180
173
  const subbies = {
181
174
  pam: now,
182
175
  jim: now + 61000, // move forward a little over a minute
183
- dwight: now
176
+ dwight: now,
184
177
  };
185
178
  const watching = {
186
179
  pam: 1,
187
- jim: 1
180
+ jim: 1,
188
181
  };
189
182
 
190
183
  worker.watchers = watching;
@@ -200,7 +193,7 @@ describe('presence-worker', () => {
200
193
  const subbies = {
201
194
  pam: now + 600000, // move forward 10 minutes
202
195
  jim: now - 20000, // move back 20 seconds
203
- dwight: now - 60000 // move back 1 minute
196
+ dwight: now - 60000, // move back 1 minute
204
197
  };
205
198
 
206
199
  worker.subscribers = subbies;
@@ -218,7 +211,7 @@ describe('presence-worker', () => {
218
211
  const presences = {
219
212
  pam: now - 300000, // 5 minutes ago
220
213
  jim: now - 600001, // little over 10 minutes ago
221
- dwight: now - 1200000 // 20 minutes ago
214
+ dwight: now - 1200000, // 20 minutes ago
222
215
  };
223
216
 
224
217
  webex.internal.presence.emitEvent = sinon.stub();
@@ -226,30 +219,33 @@ describe('presence-worker', () => {
226
219
 
227
220
  worker.cleanPresences();
228
221
 
229
- assert.calledWith(webex.internal.presence.emitEvent,
230
- 'updated',
231
- {type: 'delete', payload: ['jim', 'dwight']});
222
+ assert.calledWith(webex.internal.presence.emitEvent, 'updated', {
223
+ type: 'delete',
224
+ payload: ['jim', 'dwight'],
225
+ });
232
226
  });
233
227
  });
234
228
 
235
229
  describe('#groundskeeper()', () => {
236
230
  it('renews subscriptions', async () => {
237
- webex.internal.presence.subscribe = sinon.stub()
238
- .returns(Promise.resolve({
231
+ webex.internal.presence.subscribe = sinon.stub().returns(
232
+ Promise.resolve({
239
233
  responses: [
240
234
  {
241
235
  responseCode: 200,
242
236
  subscriptionTtl: 600,
243
237
  subject: 'pam',
244
238
  status: {
245
- subject: 'pam'
246
- }
239
+ subject: 'pam',
240
+ },
247
241
  },
248
242
  {
249
243
  responseCode: 500,
250
- subject: 'jim'
251
- }]
252
- }));
244
+ subject: 'jim',
245
+ },
246
+ ],
247
+ })
248
+ );
253
249
  worker.checkCampers = sinon.stub().returns(['pam']);
254
250
  worker.checkSubscriptions = sinon.stub().returns(['jim']);
255
251
  worker.cleanPresences = sinon.stub();
@@ -14,23 +14,30 @@ describe('plugin-presence', () => {
14
14
  beforeEach(() => {
15
15
  webex = new MockWebex({
16
16
  children: {
17
- presence: Presence
18
- }
17
+ presence: Presence,
18
+ },
19
19
  });
20
20
  });
21
21
 
22
22
  describe('#get()', () => {
23
- it('requires a person id parameter', () => assert.isRejected(webex.internal.presence.get(), /A person id is required/));
23
+ it('requires a person id parameter', () =>
24
+ assert.isRejected(webex.internal.presence.get(), /A person id is required/));
24
25
  });
25
26
 
26
27
  describe('#list()', () => {
27
- it('requires a parameter', () => assert.isRejected(webex.internal.presence.list(), /An array of person ids is required/));
28
+ it('requires a parameter', () =>
29
+ assert.isRejected(webex.internal.presence.list(), /An array of person ids is required/));
28
30
 
29
- it('requires a person array parameter', () => assert.isRejected(webex.internal.presence.list('abc'), /An array of person ids is required/));
31
+ it('requires a person array parameter', () =>
32
+ assert.isRejected(
33
+ webex.internal.presence.list('abc'),
34
+ /An array of person ids is required/
35
+ ));
30
36
  });
31
37
 
32
38
  describe('#subscribe()', () => {
33
- it('requires a person parameter', () => assert.isRejected(webex.internal.presence.subscribe(), /A person id is required/));
39
+ it('requires a person parameter', () =>
40
+ assert.isRejected(webex.internal.presence.subscribe(), /A person id is required/));
34
41
  it('subscription request called twice with batch of 100 ids', () => {
35
42
  const ids = [...Array(100).keys()];
36
43
 
@@ -38,7 +45,7 @@ describe('plugin-presence', () => {
38
45
  return Promise.resolve({
39
46
  statusCode: 204,
40
47
  body: [],
41
- options
48
+ options,
42
49
  });
43
50
  };
44
51
  sinon.spy(webex, 'request');
@@ -49,11 +56,13 @@ describe('plugin-presence', () => {
49
56
  });
50
57
 
51
58
  describe('#unsubscribe()', () => {
52
- it('requires a person parameter', () => assert.isRejected(webex.internal.presence.unsubscribe(), /A person id is required/));
59
+ it('requires a person parameter', () =>
60
+ assert.isRejected(webex.internal.presence.unsubscribe(), /A person id is required/));
53
61
  });
54
62
 
55
63
  describe('#setStatus()', () => {
56
- it('requires a status', () => assert.isRejected(webex.internal.presence.setStatus(), /A status is required/));
64
+ it('requires a status', () =>
65
+ assert.isRejected(webex.internal.presence.setStatus(), /A status is required/));
57
66
  });
58
67
  });
59
68
  });