Fix failing test

This commit is contained in:
JC Brand 2017-12-22 21:24:22 +00:00
parent aa7483a881
commit 7c782ed6a4
2 changed files with 43 additions and 41 deletions

View File

@ -1671,11 +1671,12 @@
var sent_IQ, IQ_id; var sent_IQ, IQ_id;
var sendIQ = _converse.connection.sendIQ; var sendIQ = _converse.connection.sendIQ;
test_utils.openAndEnterChatRoom(_converse, 'coven', 'chat.shakespeare.lit', 'some1').then(function () {
spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) { spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
sent_IQ = iq; sent_IQ = iq;
IQ_id = sendIQ.bind(this)(iq, callback, errback); IQ_id = sendIQ.bind(this)(iq, callback, errback);
}); });
_converse.api.rooms.open('coven@chat.shakespeare.lit', {'nick': 'some1'});
// We pretend this is a new room, so no disco info is returned. // We pretend this is a new room, so no disco info is returned.
var features_stanza = $iq({ var features_stanza = $iq({
@ -1708,9 +1709,10 @@
_converse.connection._dataRecv(test_utils.createRequest(message)); _converse.connection._dataRecv(test_utils.createRequest(message));
var $chat_body = view.$('.chatroom-body'); var $chat_body = view.$('.chatroom-body');
expect($chat_body.html().trim().indexOf( expect($chat_body.html().trim().indexOf(
'<div class="chat-info">This room is now no longer anonymous</div>' '<div class="message chat-info">This room is now no longer anonymous</div>'
)).not.toBe(-1); )).not.toBe(-1);
done(); done();
});
})); }));
it("informs users if they have been kicked out of the chat room", it("informs users if they have been kicked out of the chat room",

View File

@ -120,9 +120,9 @@
// We pretend this is a new room, so no disco info is returned. // We pretend this is a new room, so no disco info is returned.
var IQ_id = converse.connection.sendIQ.firstCall.returnValue; var IQ_id = converse.connection.sendIQ.firstCall.returnValue;
var features_stanza = $iq({ var features_stanza = $iq({
'from': 'lounge@localhost', 'from': room+'@'+server,
'id': IQ_id, 'id': IQ_id,
'to': 'dummy@localhost/desktop', 'to': nick+'@'+server+'/desktop',
'type': 'error' 'type': 'error'
}).c('error', {'type': 'cancel'}) }).c('error', {'type': 'cancel'})
.c('item-not-found', {'xmlns': "urn:ietf:params:xml:ns:xmpp-stanzas"}); .c('item-not-found', {'xmlns': "urn:ietf:params:xml:ns:xmpp-stanzas"});