Commit 7c782ed6 authored by JC Brand's avatar JC Brand

Fix failing test

parent aa7483a8
...@@ -1671,46 +1671,48 @@ ...@@ -1671,46 +1671,48 @@
var sent_IQ, IQ_id; var sent_IQ, IQ_id;
var sendIQ = _converse.connection.sendIQ; 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);
});
_converse.api.rooms.open('coven@chat.shakespeare.lit', {'nick': 'some1'});
// We pretend this is a new room, so no disco info is returned. test_utils.openAndEnterChatRoom(_converse, 'coven', 'chat.shakespeare.lit', 'some1').then(function () {
var features_stanza = $iq({ spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
from: 'coven@chat.shakespeare.lit', sent_IQ = iq;
'id': IQ_id, IQ_id = sendIQ.bind(this)(iq, callback, errback);
'to': 'dummy@localhost/desktop', });
'type': 'error'
}).c('error', {'type': 'cancel'})
.c('item-not-found', {'xmlns': "urn:ietf:params:xml:ns:xmpp-stanzas"});
_converse.connection._dataRecv(test_utils.createRequest(features_stanza));
var view = _converse.chatboxviews.get('coven@chat.shakespeare.lit'); // We pretend this is a new room, so no disco info is returned.
/* <message xmlns="jabber:client" var features_stanza = $iq({
* type="groupchat" from: 'coven@chat.shakespeare.lit',
* to="dummy@localhost/_converse.js-27854181" 'id': IQ_id,
* from="coven@chat.shakespeare.lit"> 'to': 'dummy@localhost/desktop',
* <x xmlns="http://jabber.org/protocol/muc#user"> 'type': 'error'
* <status code="104"/> }).c('error', {'type': 'cancel'})
* <status code="172"/> .c('item-not-found', {'xmlns': "urn:ietf:params:xml:ns:xmpp-stanzas"});
* </x> _converse.connection._dataRecv(test_utils.createRequest(features_stanza));
* </message>
*/ var view = _converse.chatboxviews.get('coven@chat.shakespeare.lit');
var message = $msg({ /* <message xmlns="jabber:client"
type:'groupchat', * type="groupchat"
to: 'dummy@localhost/_converse.js-27854181', * to="dummy@localhost/_converse.js-27854181"
from: 'coven@chat.shakespeare.lit' * from="coven@chat.shakespeare.lit">
}).c('x', {xmlns: Strophe.NS.MUC_USER}) * <x xmlns="http://jabber.org/protocol/muc#user">
.c('status', {code: '104'}).up() * <status code="104"/>
.c('status', {code: '172'}); * <status code="172"/>
_converse.connection._dataRecv(test_utils.createRequest(message)); * </x>
var $chat_body = view.$('.chatroom-body'); * </message>
expect($chat_body.html().trim().indexOf( */
'<div class="chat-info">This room is now no longer anonymous</div>' var message = $msg({
)).not.toBe(-1); type:'groupchat',
done(); to: 'dummy@localhost/_converse.js-27854181',
from: 'coven@chat.shakespeare.lit'
}).c('x', {xmlns: Strophe.NS.MUC_USER})
.c('status', {code: '104'}).up()
.c('status', {code: '172'});
_converse.connection._dataRecv(test_utils.createRequest(message));
var $chat_body = view.$('.chatroom-body');
expect($chat_body.html().trim().indexOf(
'<div class="message chat-info">This room is now no longer anonymous</div>'
)).not.toBe(-1);
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",
......
...@@ -120,9 +120,9 @@ ...@@ -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"});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment