|
@@ -150,6 +150,9 @@ describe('ChatRoom', () => {
|
150
|
150
|
it('parses status correctly', () => {
|
151
|
151
|
const presStr = '' +
|
152
|
152
|
'<presence to="tojid" from="fromjid">' +
|
|
153
|
+ '<x xmlns=\'http://jabber.org/protocol/muc#user\'>' +
|
|
154
|
+ '<item jid=\'fulljid\'/>' +
|
|
155
|
+ '</x>' +
|
153
|
156
|
'<status>status-text</status>' +
|
154
|
157
|
'</presence>';
|
155
|
158
|
const pres = new DOMParser().parseFromString(presStr, 'text/xml').documentElement;
|
|
@@ -160,16 +163,17 @@ describe('ChatRoom', () => {
|
160
|
163
|
XMPPEvents.PRESENCE_RECEIVED,
|
161
|
164
|
jasmine.any(Object)
|
162
|
165
|
]);
|
163
|
|
- expect(emitterSpy).toHaveBeenCalledWith(
|
|
166
|
+ expect(emitterSpy.calls.argsFor(1)).toEqual([
|
164
|
167
|
XMPPEvents.MUC_MEMBER_JOINED,
|
165
|
168
|
'fromjid',
|
166
|
169
|
undefined, // nick
|
167
|
|
- undefined, // role
|
168
|
|
- undefined, // isHiddenDomain
|
|
170
|
+ null, // role
|
|
171
|
+ false, // isHiddenDomain
|
169
|
172
|
undefined, // statsID
|
170
|
173
|
'status-text',
|
171
|
174
|
undefined,
|
172
|
|
- undefined);
|
|
175
|
+ undefined
|
|
176
|
+ ]);
|
173
|
177
|
});
|
174
|
178
|
|
175
|
179
|
it('parses muc user item correctly', () => {
|
|
@@ -202,6 +206,9 @@ describe('ChatRoom', () => {
|
202
|
206
|
it('parses identity correctly', () => {
|
203
|
207
|
const presStr = '' +
|
204
|
208
|
'<presence to="tojid" from="fromjid">' +
|
|
209
|
+ '<x xmlns=\'http://jabber.org/protocol/muc#user\'>' +
|
|
210
|
+ '<item jid=\'fulljid\'/>' +
|
|
211
|
+ '</x>' +
|
205
|
212
|
'<status>status-text</status>' +
|
206
|
213
|
'<identity>' +
|
207
|
214
|
'<user>' +
|
|
@@ -229,22 +236,26 @@ describe('ChatRoom', () => {
|
229
|
236
|
XMPPEvents.PRESENCE_RECEIVED,
|
230
|
237
|
jasmine.any(Object)
|
231
|
238
|
]);
|
232
|
|
- expect(emitterSpy).toHaveBeenCalledWith(
|
|
239
|
+ expect(emitterSpy.calls.argsFor(1)).toEqual([
|
233
|
240
|
XMPPEvents.MUC_MEMBER_JOINED,
|
234
|
241
|
'fromjid',
|
235
|
242
|
undefined, // nick
|
236
|
|
- undefined, // role
|
237
|
|
- undefined, // isHiddenDomain
|
|
243
|
+ null, // role
|
|
244
|
+ false, // isHiddenDomain
|
238
|
245
|
undefined, // statsID
|
239
|
246
|
'status-text',
|
240
|
247
|
expectedIdentity,
|
241
|
|
- undefined);
|
|
248
|
+ undefined
|
|
249
|
+ ]);
|
242
|
250
|
});
|
243
|
251
|
|
244
|
252
|
it('parses bot correctly', () => {
|
245
|
253
|
const expectedBotType = 'some_bot_type';
|
246
|
254
|
const presStr = '' +
|
247
|
255
|
'<presence to="tojid" from="fromjid">' +
|
|
256
|
+ '<x xmlns=\'http://jabber.org/protocol/muc#user\'>' +
|
|
257
|
+ '<item jid=\'fulljid\'/>' +
|
|
258
|
+ '</x>' +
|
248
|
259
|
'<status>status-text</status>' +
|
249
|
260
|
`<bot type="${expectedBotType}"/>` +
|
250
|
261
|
'</presence>';
|
|
@@ -256,16 +267,17 @@ describe('ChatRoom', () => {
|
256
|
267
|
XMPPEvents.PRESENCE_RECEIVED,
|
257
|
268
|
jasmine.any(Object)
|
258
|
269
|
]);
|
259
|
|
- expect(emitterSpy).toHaveBeenCalledWith(
|
|
270
|
+ expect(emitterSpy.calls.argsFor(1)).toEqual([
|
260
|
271
|
XMPPEvents.MUC_MEMBER_JOINED,
|
261
|
272
|
'fromjid',
|
262
|
273
|
undefined, // nick
|
263
|
|
- undefined, // role
|
264
|
|
- undefined, // isHiddenDomain
|
|
274
|
+ null, // role
|
|
275
|
+ false, // isHiddenDomain
|
265
|
276
|
undefined, // statsID
|
266
|
277
|
'status-text',
|
267
|
278
|
undefined,
|
268
|
|
- expectedBotType);
|
|
279
|
+ expectedBotType
|
|
280
|
+ ]);
|
269
|
281
|
});
|
270
|
282
|
|
271
|
283
|
});
|