Browse Source

fix(ChatRoom.spec): broken by 0f4cd357 "ignore undefined from"

dev1
paweldomas 5 years ago
parent
commit
ddde1cc80e
1 changed files with 24 additions and 12 deletions
  1. 24
    12
      modules/xmpp/ChatRoom.spec.js

+ 24
- 12
modules/xmpp/ChatRoom.spec.js View File

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

Loading…
Cancel
Save