Fix broken tests

This commit is contained in:
JC Brand 2018-01-10 12:25:40 +00:00
parent 31e884f79a
commit e5b256e45e
3 changed files with 23 additions and 12 deletions

View File

@ -5,6 +5,7 @@
### Bugfixes
- #800 Could not register successfully in ejabberd 17.01
- #949 Don't flash the roster contacts filter (i.e. hide by default)
- #951 Duplicate messages received in an MUC chat room.
- #953 MUC "Features" displayed when exiting configuration
- #967 Rooms list doesn't show when the server doesn't support bookmarks
- Don't require `auto_login` to be `true` when using the API to log in.

2
package-lock.json generated
View File

@ -921,7 +921,7 @@
"dev": true
},
"backbone.overview": {
"version": "git+https://github.com/jcbrand/Backbone.Overview.git#16239768880044f402edbdb1843220c44204cf15",
"version": "git+https://github.com/jcbrand/Backbone.Overview.git#1c67a73be1f43cbb39fcd6b1b5d3cfc0ffdf2b5c",
"dev": true,
"requires": {
"backbone": "1.3.3"

View File

@ -75,9 +75,8 @@
test_utils.createContacts(_converse, 'current');
test_utils.waitUntil(function () {
return $(_converse.rosterview.el).find('.roster-group .group-toggle').length;
}, 300)
.then(function () {
return $(_converse.rosterview.el).find('.roster-group .group-toggle').length;
}, 300).then(function () {
test_utils.openAndEnterChatRoom(_converse, 'lounge', 'localhost', 'dummy').then(function () {
var jid = 'lounge@localhost';
var room = _converse.api.rooms.get(jid);
@ -289,6 +288,7 @@
});
describe("An instant chat room", function () {
it("will be created when muc_instant_rooms is set to true",
mock.initConverseWithPromises(
null, ['rosterGroupsFetched'], {},
@ -297,9 +297,17 @@
var sent_IQ, IQ_id;
var sendIQ = _converse.connection.sendIQ;
spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
sent_IQ = iq;
IQ_id = sendIQ.bind(this)(iq, callback, errback);
if (iq.nodeTree.getAttribute('to') === 'lounge@localhost') {
sent_IQ = iq;
IQ_id = sendIQ.bind(this)(iq, callback, errback);
} else {
sendIQ.bind(this)(iq, callback, errback);
}
});
test_utils.openChatRoom(_converse, 'lounge', 'localhost', 'dummy');
// We pretend this is a new room, so no disco info is returned.
//
/* <iq from="jordie.langen@chat.example.org/converse.js-11659299" to="myroom@conference.chat.example.org" type="get">
* <query xmlns="http://jabber.org/protocol/disco#info"/>
* </iq>
@ -309,10 +317,8 @@
* </error>
* </iq>
*/
test_utils.openChatRoom(_converse, 'lounge', 'localhost', 'dummy');
// We pretend this is a new room, so no disco info is returned.
var features_stanza = $iq({
from: 'lounge@localhost',
'from': 'lounge@localhost',
'id': IQ_id,
'to': 'dummy@localhost/desktop',
'type': 'error'
@ -337,7 +343,7 @@
"type='get' xmlns='jabber:client' id='"+IQ_id+"'>"+
"<query xmlns='http://jabber.org/protocol/disco#info' node='x-roomuser-item'/></iq>"
}, 300).then(function () {
/* * <iq xmlns="jabber:client" type="error" to="jordie.langen@chat.example.org/converse.js-11659299" from="myroom@conference.chat.example.org">
/* <iq xmlns="jabber:client" type="error" to="jordie.langen@chat.example.org/converse.js-11659299" from="myroom@conference.chat.example.org">
* <error type="cancel">
* <item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
* </error>
@ -1238,8 +1244,12 @@
var sent_IQ, IQ_id;
var sendIQ = _converse.connection.sendIQ;
spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
sent_IQ = iq;
IQ_id = sendIQ.bind(this)(iq, callback, errback);
if (iq.nodeTree.getAttribute('to') === 'lounge@localhost') {
sent_IQ = iq;
IQ_id = sendIQ.bind(this)(iq, callback, errback);
} else {
sendIQ.bind(this)(iq, callback, errback);
}
});
test_utils.openChatRoom(_converse, 'lounge', 'localhost', 'dummy');