spec/smacks: prevent two MUCs from being created

This commit is contained in:
JC Brand 2020-10-28 14:50:51 +01:00
parent c08ee00fcd
commit fe17be24e0

View File

@ -231,9 +231,8 @@ describe("XEP-0198 Stream Management", function () {
}) })
); );
_converse.no_connection_on_bind = true; // XXX Don't trigger CONNECTED in tests/mock.js _converse.no_connection_on_bind = true; // XXX Don't trigger CONNECTED in MockConnection
await _converse.api.user.login('romeo@montague.lit', 'secret'); await _converse.api.user.login('romeo@montague.lit', 'secret');
delete _converse.no_connection_on_bind;
const sent_stanzas = _converse.connection.sent_stanzas; const sent_stanzas = _converse.connection.sent_stanzas;
const stanza = await u.waitUntil(() => sent_stanzas.filter(s => (s.tagName === 'resume')).pop()); const stanza = await u.waitUntil(() => sent_stanzas.filter(s => (s.tagName === 'resume')).pop());
@ -243,7 +242,6 @@ describe("XEP-0198 Stream Management", function () {
_converse.connection._dataRecv(mock.createRequest(result)); _converse.connection._dataRecv(mock.createRequest(result));
expect(_converse.session.get('smacks_enabled')).toBe(true); expect(_converse.session.get('smacks_enabled')).toBe(true);
const nick = 'romeo'; const nick = 'romeo';
const func = _converse.chatboxes.onChatBoxesFetched; const func = _converse.chatboxes.onChatBoxesFetched;
spyOn(_converse.chatboxes, 'onChatBoxesFetched').and.callFake(collection => { spyOn(_converse.chatboxes, 'onChatBoxesFetched').and.callFake(collection => {
@ -274,6 +272,8 @@ describe("XEP-0198 Stream Management", function () {
await u.waitUntil(() => muc.messages.length); await u.waitUntil(() => muc.messages.length);
expect(muc.messages.at(0).get('message')).toBe('First message') expect(muc.messages.at(0).get('message')).toBe('First message')
delete _converse.no_connection_on_bind;
done(); done();
})); }));
}); });