Browse Source

Bugfix. [] evaluates to truthy

JC Brand 6 năm trước cách đây
mục cha
commit
4cd06b645d
1 tập tin đã thay đổi với 3 bổ sung2 xóa
  1. 3 2
      tests/utils.js

+ 3 - 2
tests/utils.js

@@ -138,7 +138,8 @@
                 'name': room[0].toUpperCase() + room.slice(1),
                 'type': 'text'
             }).up();
-        features = features || [
+
+        features = features.length ? features : [
             'http://jabber.org/protocol/muc',
             'jabber:iq:register',
             'muc_passwordprotected',
@@ -155,8 +156,8 @@
                 .c('value').t('This is the description').up().up()
             .c('field', {'type':'text-single', 'var':'muc#roominfo_occupants', 'label':'Number of occupants'})
                 .c('value').t(0);
-
         _converse.connection._dataRecv(utils.createRequest(features_stanza));
+
         const iq = await utils.waitUntil(() => _.filter(
             stanzas,
             s => sizzle(`iq[to="${room_jid}"] query[node="x-roomuser-item"]`, s.nodeTree).length