Commit 877e0777 authored by JC Brand's avatar JC Brand

Remove need to pass in spies to `initConverse`

They aren't used anymore.
parent 9d77a4ef
......@@ -13,7 +13,7 @@
it("shows all autocompletion options when the user presses @",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'tom');
......@@ -55,7 +55,7 @@
it("autocompletes when the user presses tab",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
......@@ -166,7 +166,7 @@
it("autocompletes when the user presses backspace",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
......
......@@ -16,7 +16,7 @@
describe("A chat room", function () {
it("can be bookmarked", mock.initConverse(
null, ['rosterGroupsFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'emojisInitialized'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
......@@ -142,7 +142,7 @@
it("will be automatically opened if 'autojoin' is set on the bookmark", mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
......@@ -186,7 +186,7 @@
describe("when bookmarked", function () {
it("will use the nickname from the bookmark", mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
......@@ -211,7 +211,7 @@
}));
it("displays that it's bookmarked through its bookmark icon", mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.waitUntilDiscoConfirmed(
......@@ -239,7 +239,7 @@
}));
it("can be unbookmarked", mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
let sent_stanza, IQ_id;
......@@ -317,7 +317,7 @@
describe("and when autojoin is set", function () {
it("will be be opened and joined automatically upon login", mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilBookmarksReturned(_converse);
......@@ -346,7 +346,7 @@
describe("Bookmarks", function () {
it("can be pushed from the XMPP server", mock.initConverse(
['send'], ['rosterGroupsFetched', 'connected'], {},
['rosterGroupsFetched', 'connected'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
......@@ -404,7 +404,7 @@
it("can be retrieved from the XMPP server", mock.initConverse(
null, ['chatBoxesFetched', 'roomsPanelRendered', 'rosterGroupsFetched'], {},
['chatBoxesFetched', 'roomsPanelRendered', 'rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
......@@ -482,7 +482,7 @@
describe("The rooms panel", function () {
it("shows a list of bookmarks", mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
......@@ -558,7 +558,7 @@
it("remembers the toggle state of the bookmarks list", mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.openControlBox();
......@@ -614,7 +614,7 @@
describe("When hide_open_bookmarks is true and a bookmarked room is opened", function () {
it("can be closed", mock.initConverse(
null, ['rosterGroupsFetched'],
['rosterGroupsFetched'],
{ hide_open_bookmarks: true },
async function (done, _converse) {
......
This diff is collapsed.
......@@ -12,7 +12,7 @@
it("can be opened by clicking a DOM element with class 'toggle-controlbox'",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
function (done, _converse) {
// This spec will only pass if the controlbox is not currently
......@@ -38,7 +38,7 @@
it("can be used to add contact and it checks for case-sensivity",
mock.initConverse(
null, ['rosterGroupsFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'emojisInitialized'], {},
async function (done, _converse) {
spyOn(_converse.api, "trigger").and.callThrough();
......@@ -66,7 +66,7 @@
it("shows the number of unread mentions received",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
test_utils.createContacts(_converse, 'all').openControlBox();
......@@ -116,7 +116,7 @@
it("shows the user's chat status, which is online by default",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
function (done, _converse) {
test_utils.openControlBox();
......@@ -128,7 +128,7 @@
it("can be used to set the current user's chat status",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.openControlBox();
......@@ -157,7 +157,7 @@
it("can be used to set a custom status message",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.openControlBox();
......@@ -191,7 +191,7 @@
it("opens up an add modal when you click on it",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.createContacts(_converse, 'all').openControlBox();
......@@ -226,7 +226,7 @@
it("can be configured to not provide search suggestions",
mock.initConverse(
null, ['rosterGroupsFetched'], {'autocomplete_add_contact': false},
['rosterGroupsFetched'], {'autocomplete_add_contact': false},
async function (done, _converse) {
test_utils.openControlBox();
......@@ -257,7 +257,7 @@
it("integrates with xhr_user_search_url to search for contacts",
mock.initConverse(
null, ['rosterGroupsFetched'],
['rosterGroupsFetched'],
{ 'xhr_user_search_url': 'http://example.org/?' },
async function (done, _converse) {
......@@ -314,7 +314,7 @@
it("can be configured to not provide search suggestions for XHR search results",
mock.initConverse(
null, ['rosterGroupsFetched'],
['rosterGroupsFetched'],
{ 'autocomplete_add_contact': false,
'xhr_user_search_url': 'http://example.org/?' },
async function (done, _converse) {
......
......@@ -30,7 +30,7 @@
describe("A chat state indication", function () {
it("are sent out when the client becomes or stops being idle",
mock.initConverse(null, ['discoInitialized'], {}, (done, _converse) => {
mock.initConverse(['discoInitialized'], {}, (done, _converse) => {
spyOn(_converse, 'sendCSI').and.callThrough();
let sent_stanza;
......@@ -215,7 +215,7 @@
it("has a method 'get' which returns wrapped contacts",
mock.initConverse(
null, ['emojisInitialized'], {},
['emojisInitialized'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
......@@ -253,7 +253,7 @@
describe("The \"chats\" API", function() {
it("has a method 'get' which returns the promise that resolves to a chat model", mock.initConverse(
null, ['rosterInitialized', 'chatBoxesInitialized'], {},
['rosterInitialized', 'chatBoxesInitialized'], {},
async (done, _converse) => {
test_utils.openControlBox();
......@@ -289,7 +289,7 @@
}));
it("has a method 'open' which opens and returns a promise that resolves to a chat model", mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesInitialized'], {},
['rosterGroupsFetched', 'chatBoxesInitialized'], {},
async (done, _converse) => {
test_utils.openControlBox();
......@@ -321,9 +321,8 @@
});
describe("The \"settings\" API", function() {
it("has methods 'get' and 'set' to set configuration settings", mock.initConverse(
null, null, {'play_sounds': true},
(done, _converse) => {
it("has methods 'get' and 'set' to set configuration settings",
mock.initConverse(null, {'play_sounds': true}, (done, _converse) => {
expect(_.keys(_converse.api.settings)).toEqual(["update", "get", "set"]);
expect(_converse.api.settings.get("play_sounds")).toBe(true);
......
......@@ -16,7 +16,7 @@
it("stores the features it receives",
mock.initConverse(
null, ['discoInitialized'], {},
['discoInitialized'], {},
async function (done, _converse) {
const IQ_stanzas = _converse.connection.IQ_stanzas;
......@@ -179,7 +179,7 @@
describe("Whenever converse.js discovers a new server feature", function () {
it("emits the serviceDiscovered event",
mock.initConverse(
null, ['discoInitialized'], {},
['discoInitialized'], {},
function (done, _converse) {
sinon.spy(_converse.api, "trigger");
......
......@@ -14,7 +14,7 @@
it("can be opened by clicking a button in the chat toolbar",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
......@@ -41,7 +41,7 @@
it("is opened to autocomplete emojis in the textarea",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
......@@ -109,7 +109,7 @@
it("allows you to search for particular emojis",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
......@@ -161,7 +161,7 @@
describe("A Chat Message", function () {
it("will display larger if it's only emojis",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {'use_system_emojis': true},
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {'use_system_emojis': true},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
......
......@@ -40,7 +40,7 @@
}));
it("will open and display headline messages", mock.initConverse(
null, ['rosterGroupsFetched'], {}, function (done, _converse) {
['rosterGroupsFetched'], {}, function (done, _converse) {
/* <message from='notify.example.com'
* to='romeo@im.example.com'
......
......@@ -172,7 +172,7 @@
it("does not appear in private chats",
mock.initConverse(
null, ['emojisInitialized'], {},
['emojisInitialized'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 3);
......@@ -191,7 +191,7 @@
}));
it("does not appear in MUC chats", mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async (done, _converse) => {
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
......@@ -233,7 +233,7 @@
}));
it("appears in MUC chats", mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async (done, _converse) => {
await test_utils.waitUntilDiscoConfirmed(
......@@ -464,7 +464,7 @@
it("shows an error message if the file is too large",
mock.initConverse(
null, ['emojisInitialized'], {},
['emojisInitialized'], {},
async function (done, _converse) {
const IQ_stanzas = _converse.connection.IQ_stanzas;
......@@ -587,7 +587,7 @@
describe("While a file is being uploaded", function () {
it("shows a progress bar", mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
......
......@@ -8,7 +8,7 @@
it("contains a checkbox to indicate whether the computer is trusted or not",
mock.initConverse(
null, ['chatBoxesInitialized'],
['chatBoxesInitialized'],
{ auto_login: false,
allow_registration: false },
async function (done, _converse) {
......@@ -42,7 +42,7 @@
it("checkbox can be set to false by default",
mock.initConverse(
null, ['chatBoxesInitialized'],
['chatBoxesInitialized'],
{ auto_login: false,
trusted: false,
allow_registration: false },
......
......@@ -17,9 +17,7 @@
describe("The XEP-0313 Archive", function () {
it("is queried when the user enters a new MUC",
mock.initConverse(
null, ['discoInitialized'], {'archived_messages_page_size': 2},
async function (done, _converse) {
mock.initConverse(['discoInitialized'], {'archived_messages_page_size': 2}, async function (done, _converse) {
spyOn(_converse.ChatBox.prototype, 'fetchArchivedMessages').and.callThrough();
const sent_IQs = _converse.connection.IQ_stanzas;
......@@ -211,7 +209,7 @@
it("is discarded if it doesn't come from the right sender",
mock.initConverse(
null, ['discoInitialized'], {},
['discoInitialized'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
......@@ -267,7 +265,7 @@
it("updates the is_archived value of an already cached version",
mock.initConverse(
null, ['discoInitialized'], {},
['discoInitialized'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'trek-radio@conference.lightwitch.org', 'romeo');
......@@ -315,7 +313,7 @@
it("isn't shown as duplicate by comparing its stanza id or archive id",
mock.initConverse(
null, ['discoInitialized'], {},
['discoInitialized'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'trek-radio@conference.lightwitch.org', 'jcbrand');
......@@ -354,7 +352,7 @@
it("isn't shown as duplicate by comparing only the archive id",
mock.initConverse(
null, ['discoInitialized'], {},
['discoInitialized'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'discuss@conference.conversejs.org', 'romeo');
......@@ -407,9 +405,7 @@
describe("The archive.query API", function () {
it("can be used to query for all archived messages",
mock.initConverse(
null, ['discoInitialized'], {},
async function (done, _converse) {
mock.initConverse(['discoInitialized'], {}, async function (done, _converse) {
const sendIQ = _converse.connection.sendIQ;
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, null, [Strophe.NS.MAM]);
......@@ -427,9 +423,7 @@
}));
it("can be used to query for all messages to/from a particular JID",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, null, [Strophe.NS.MAM]);
let sent_stanza, IQ_id;
......@@ -458,9 +452,7 @@
}));
it("can be used to query for archived messages from a chat room",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
const room_jid = 'coven@chat.shakespeare.lit';
_converse.api.archive.query({'with': room_jid, 'groupchat': true});
......@@ -485,9 +477,7 @@
}));
it("checks whether returned MAM messages from a MUC room are from the right JID",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
const room_jid = 'coven@chat.shakespeare.lit';
const promise = _converse.api.archive.query({'with': room_jid, 'groupchat': true, 'max':'10'});
......@@ -556,9 +546,7 @@
}));
it("can be used to query for all messages in a certain timespan",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, null, [Strophe.NS.MAM]);
let sent_stanza, IQ_id;
......@@ -596,9 +584,7 @@
}));
it("throws a TypeError if an invalid date is provided",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, null, [Strophe.NS.MAM]);
try {
......@@ -610,9 +596,7 @@
}));
it("can be used to query for all messages after a certain time",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, null, [Strophe.NS.MAM]);
let sent_stanza, IQ_id;
......@@ -646,9 +630,7 @@
}));
it("can be used to query for a limited set of results",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, null, [Strophe.NS.MAM]);
let sent_stanza, IQ_id;
......@@ -682,9 +664,7 @@
}));
it("can be used to page through results",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, null, [Strophe.NS.MAM]);
let sent_stanza, IQ_id;
......@@ -722,9 +702,7 @@
}));
it("accepts \"before\" with an empty string as value to reverse the order",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, null, [Strophe.NS.MAM]);
let sent_stanza, IQ_id;
......@@ -754,9 +732,7 @@
}));
it("accepts a _converse.RSM object for the query options",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, null, [Strophe.NS.MAM]);
let sent_stanza, IQ_id;
......@@ -798,9 +774,7 @@
}));
it("returns an object which includes the messages and a _converse.RSM object",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, null, [Strophe.NS.MAM]);
let sent_stanza, IQ_id;
......@@ -886,9 +860,7 @@
describe("The default preference", function () {
it("is set once server support for MAM has been confirmed",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
const entity = await _converse.api.disco.entities.get(_converse.domain);
let sent_stanza, IQ_id;
......@@ -969,9 +941,7 @@
describe("A Chatbox", function () {
it("will fetch archived messages once it's opened",
mock.initConverse(
null, ['discoInitialized'], {},
async function (done, _converse) {
mock.initConverse(['discoInitialized'], {}, async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
const contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@montague.lit';
......@@ -1031,9 +1001,7 @@
}));
it("will show an error message if the MAM query times out",
mock.initConverse(
null, ['discoInitialized'], {},
async function (done, _converse) {
mock.initConverse(['discoInitialized'], {}, async function (done, _converse) {
const sendIQ = _converse.connection.sendIQ;
......
This diff is collapsed.
......@@ -10,7 +10,7 @@
it("shows chats that have been minimized",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.createContacts(_converse, 'current');
......@@ -45,7 +45,7 @@
it("can be toggled to hide or show minimized chats",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.createContacts(_converse, 'current');
......@@ -73,7 +73,7 @@
it("shows the number messages received to minimized chats",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
function (done, _converse) {
test_utils.createContacts(_converse, 'current');
......@@ -152,7 +152,7 @@
it("shows the number messages received to minimized groupchats",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'kitchen@conference.shakespeare.lit';
......
......@@ -11,7 +11,7 @@
it("allows you to set affiliations and roles",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
spyOn(_converse.ChatRoomView.prototype, 'showModeratorToolsModal').and.callThrough();
......@@ -138,7 +138,7 @@
it("shows an error message if a particular affiliation list may not be retrieved",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
spyOn(_converse.ChatRoomView.prototype, 'showModeratorToolsModal').and.callThrough();
......
This diff is collapsed.
......@@ -13,7 +13,7 @@
it("is rejected if it's an unencapsulated forwarded message",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
......@@ -49,7 +49,7 @@
it("is specially marked when you are mentioned in it",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
......@@ -72,7 +72,7 @@
it("can not be expected to have a unique id attribute",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
......@@ -104,7 +104,7 @@
it("is ignored if it has the same stanza-id of an already received on",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'room@muc.example.com';
......@@ -150,7 +150,7 @@
it("will be discarded if it's a malicious message meant to look like a carbon copy",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
......@@ -210,7 +210,7 @@
it("keeps track of the sender's role and affiliation",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
......@@ -338,7 +338,7 @@
it("keeps track whether you are the sender or not",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
......@@ -358,7 +358,7 @@
it("can be replaced with a correction",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
......@@ -425,7 +425,7 @@
it("can be sent as a correction by using the up arrow",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
......@@ -530,7 +530,7 @@
it("will be shown as received upon MUC reflection",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
......@@ -573,7 +573,7 @@
it("gets updated with its stanza-id upon MUC reflection",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'room@muc.example.com';
......@@ -609,7 +609,7 @@
it("can cause a delivery receipt to be returned",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
......@@ -645,7 +645,7 @@
it("can cause a chat marker to be returned",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
......@@ -714,7 +714,7 @@
it("highlights all users mentioned via XEP-0372 references",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
......@@ -760,7 +760,7 @@
it("gets parsed for mentions which get turned into references",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
......@@ -842,7 +842,7 @@
it("parses for mentions as indicated with an @ preceded by a space or at the start of the text",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
......@@ -877,7 +877,7 @@
it("can get corrected and given new references",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
......@@ -953,7 +953,7 @@
it("includes XEP-0372 references to that person",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
......
......@@ -14,9 +14,7 @@
describe("an HTML5 Notification", function () {
it("is shown when a new private message is received",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
async (done, _converse) => {
mock.initConverse(['rosterGroupsFetched'], {}, async (done, _converse) => {
await test_utils.waitForRoster(_converse, 'current');
spyOn(_converse, 'showMessageNotification').and.callThrough();
......@@ -40,9 +38,7 @@
}));
it("is shown when you are mentioned in a groupchat",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
async (done, _converse) => {
mock.initConverse(['rosterGroupsFetched'], {}, async (done, _converse) => {
await test_utils.createContacts(_converse, 'current');
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
......@@ -82,9 +78,7 @@
}));
it("is shown for headline messages",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
async (done, _converse) => {
mock.initConverse(['rosterGroupsFetched'], {}, async (done, _converse) => {
spyOn(_converse, 'showMessageNotification').and.callThrough();
spyOn(_converse, 'isMessageToHiddenChat').and.returnValue(true);
......@@ -166,9 +160,7 @@
describe("A notification sound", function () {
it("is played when the current user is mentioned in a groupchat",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
async (done, _converse) => {
mock.initConverse(['rosterGroupsFetched'], {}, async (done, _converse) => {
test_utils.createContacts(_converse, 'current');
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
......
......@@ -77,7 +77,7 @@
it("adds methods for encrypting and decrypting messages via AES GCM",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
const message = 'This message will be encrypted'
......@@ -94,7 +94,7 @@
it("enables encrypted messages to be sent and received",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
async function (done, _converse) {
let sent_stanza;
......@@ -234,7 +234,7 @@
it("enables encrypted groupchat messages to be sent and received",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
// MEMO encryption works only in members only conferences
......@@ -381,7 +381,7 @@
it("will create a new device based on a received carbon message",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, [], [Strophe.NS.SID]);
......@@ -472,7 +472,7 @@
it("gracefully handles auth errors when trying to send encrypted groupchat messages",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
// MEMO encryption works only in members only conferences
......@@ -601,7 +601,7 @@
it("can receive a PreKeySignalMessage",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
_converse.NUM_PREKEYS = 5; // Restrict to 5, otherwise the resulting stanza is too large to easily test
......@@ -701,7 +701,7 @@
it("updates device lists based on PEP messages",
mock.initConverse(
null, ['rosterGroupsFetched'], {'allow_non_roster_messaging': true},
['rosterGroupsFetched'], {'allow_non_roster_messaging': true},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
......@@ -875,7 +875,7 @@
it("updates device bundles based on PEP messages",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
......@@ -1025,7 +1025,7 @@
it("publishes a bundle with which an encrypted session can be created",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
......@@ -1104,7 +1104,7 @@
it("adds a toolbar button for starting an encrypted chat session",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
......@@ -1269,7 +1269,7 @@
it("adds a toolbar button for starting an encrypted groupchat session",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'view_mode': 'fullscreen'},
['rosterGroupsFetched', 'chatBoxesFetched'], {'view_mode': 'fullscreen'},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
......@@ -1451,7 +1451,7 @@
it("shows OMEMO device fingerprints in the user details modal",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
......
......@@ -15,7 +15,7 @@
it("includes a entity capabilities node",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
(done, _converse) => {
_converse.api.disco.own.identities.clear();
......@@ -71,7 +71,7 @@
it("includes the saved status message",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async (done, _converse) => {
test_utils.openControlBox();
......@@ -111,7 +111,7 @@
it("has its priority taken into account",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
(done, _converse) => {
test_utils.openControlBox();
......
......@@ -10,7 +10,7 @@
it("shows users currently present in the groupchat",
mock.initConverse(
null, ['rosterGroupsFetched'], {'muc_show_join_leave': false},
['rosterGroupsFetched'], {'muc_show_join_leave': false},
async function (done, _converse) {
test_utils.openControlBox();
......@@ -37,7 +37,7 @@
xit("adds hundreds of contacts to the roster",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
function (done, _converse) {
_converse.roster_groups = false;
......@@ -81,7 +81,7 @@
xit("adds hundreds of contacts to the roster, with roster groups",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
function (done, _converse) {
// _converse.show_only_online_users = true;
......
......@@ -50,7 +50,7 @@
*/
it("Subscribe to contact, contact accepts and subscribes back",
mock.initConverse(
null, ['rosterGroupsFetched'],
['rosterGroupsFetched'],
{ roster_groups: false },
async function (done, _converse) {
......@@ -368,7 +368,7 @@
it("Alternate Flow: Contact Declines Subscription Request",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
function (done, _converse) {
/* The process by which a user subscribes to a contact, including
......@@ -451,7 +451,7 @@
it("Unsubscribe to a contact when subscription is mutual",
mock.initConverse(
null, ['rosterGroupsFetched'],
['rosterGroupsFetched'],
{ roster_groups: false },
async function (done, _converse) {
......@@ -510,7 +510,7 @@
}));
it("Receiving a subscription request", mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
spyOn(_converse.api, "trigger").and.callThrough();
......
......@@ -11,7 +11,7 @@
describe("XEP-0357 Push Notifications", function () {
it("can be enabled",
mock.initConverse(null,
mock.initConverse(
['rosterGroupsFetched'], {
'push_app_servers': [{
'jid': 'push-5@client.example',
......@@ -49,7 +49,7 @@
}));
it("can be enabled for a MUC domain",
mock.initConverse(null,
mock.initConverse(
['rosterGroupsFetched'], {
'enable_muc_push': true,
'push_app_servers': [{
......@@ -109,7 +109,7 @@
}));
it("can be disabled",
mock.initConverse(null,
mock.initConverse(
['rosterGroupsFetched'], {
'push_app_servers': [{
'jid': 'push-5@client.example',
......@@ -145,7 +145,7 @@
it("can require a secret token to be included",
mock.initConverse(null,
mock.initConverse(
['rosterGroupsFetched'], {
'push_app_servers': [{
'jid': 'push-5@client.example',
......
......@@ -10,7 +10,7 @@
it("is not available unless allow_registration=true",
mock.initConverse(
null, ['chatBoxesInitialized'],
['chatBoxesInitialized'],
{ auto_login: false,
allow_registration: false },
async function (done, _converse) {
......@@ -24,7 +24,7 @@
it("can be opened by clicking on the registration tab",
mock.initConverse(
null, ['chatBoxesInitialized'],
['chatBoxesInitialized'],
{ auto_login: false,
allow_registration: true },
async function (done, _converse) {
......@@ -45,7 +45,7 @@
it("allows the user to choose an XMPP provider's domain",
mock.initConverse(
null, ['chatBoxesInitialized'],
['chatBoxesInitialized'],
{ auto_login: false,
allow_registration: true },
async function (done, _converse) {
......@@ -81,7 +81,7 @@
it("will render a registration form as received from the XMPP provider",
mock.initConverse(
null, ['chatBoxesInitialized'],
['chatBoxesInitialized'],
{ auto_login: false,
allow_registration: true },
async function (done, _converse) {
......@@ -137,7 +137,7 @@
it("will set form_type to legacy and submit it as legacy",
mock.initConverse(
null, ['chatBoxesInitialized'],
['chatBoxesInitialized'],
{ auto_login: false,
allow_registration: true },
async function (done, _converse) {
......@@ -194,7 +194,7 @@
it("will set form_type to xform and submit it as xform",
mock.initConverse(
null, ['chatBoxesInitialized'],
['chatBoxesInitialized'],
{ auto_login: false,
allow_registration: true },
async function (done, _converse) {
......@@ -267,7 +267,7 @@
it("renders the account registration form",
mock.initConverse(
null, ['chatBoxesInitialized'],
['chatBoxesInitialized'],
{ auto_login: false,
view_mode: 'fullscreen',
allow_registration: true },
......
......@@ -14,7 +14,7 @@
it("allows you to register your nickname in a room",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'auto_register_muc_nickname': true},
['rosterGroupsFetched', 'chatBoxesFetched'], {'auto_register_muc_nickname': true},
async function (done, _converse) {
const muc_jid = 'coven@chat.shakespeare.lit';
......@@ -71,7 +71,7 @@
it("allows you to automatically register your nickname when joining a room",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'auto_register_muc_nickname': true},
['rosterGroupsFetched', 'chatBoxesFetched'], {'auto_register_muc_nickname': true},
async function (done, _converse) {
const muc_jid = 'coven@chat.shakespeare.lit';
......
......@@ -8,7 +8,7 @@
describe("A list of open groupchats", function () {
it("is shown in controlbox", mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'],
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'],
{ allow_bookmarks: false // Makes testing easier, otherwise we
// have to mock stanza traffic.
}, async function (done, _converse) {
......@@ -53,7 +53,6 @@
it("uses bookmarks to determine groupchat names",
mock.initConverse(
null,
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'],
{'view_mode': 'fullscreen'},
async function (done, _converse) {
......@@ -114,7 +113,7 @@
describe("A groupchat shown in the groupchats list", function () {
it("is highlighted if it's currently open", mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'],
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'],
{ view_mode: 'fullscreen',
allow_bookmarks: false // Makes testing easier, otherwise we have to mock stanza traffic.
}, async function (done, _converse) {
......@@ -141,7 +140,7 @@
}));
it("has an info icon which opens a details modal when clicked", mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'],
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'],
{ whitelisted_plugins: ['converse-roomslist'],
allow_bookmarks: false // Makes testing easier, otherwise we
// have to mock stanza traffic.
......@@ -246,7 +245,7 @@
}));
it("can be closed", mock.initConverse(
null, ['rosterGroupsFetched', 'emojisInitialized'],
['rosterGroupsFetched', 'emojisInitialized'],
{ whitelisted_plugins: ['converse-roomslist'],
allow_bookmarks: false // Makes testing easier, otherwise we have to mock stanza traffic.
},
......@@ -271,7 +270,7 @@
}));
it("shows unread messages directed at the user", mock.initConverse(
null, null,
null,
{ whitelisted_plugins: ['converse-roomslist'],
allow_bookmarks: false // Makes testing easier, otherwise we have to mock stanza traffic.
}, async (done, _converse) => {
......
This diff is collapsed.
......@@ -11,7 +11,7 @@
it("gets enabled with an <enable> stanza and resumed with a <resume> stanza",
mock.initConverse(
null, ['chatBoxesInitialized'],
['chatBoxesInitialized'],
{ 'auto_login': false,
'enable_smacks': true,
'show_controlbox_by_default': true,
......
......@@ -11,7 +11,7 @@
it("can be received with a hint",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async (done, _converse) => {
await test_utils.waitForRoster(_converse, 'current');
......@@ -48,7 +48,7 @@
it("can be received without a hint",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async (done, _converse) => {
await test_utils.waitForRoster(_converse, 'current');
......@@ -82,7 +82,7 @@
it("can be sent without a hint",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async (done, _converse) => {
await test_utils.waitForRoster(_converse, 'current', 1);
......@@ -155,7 +155,7 @@
it("can be sent with a hint",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async (done, _converse) => {
await test_utils.waitForRoster(_converse, 'current', 1);
......
......@@ -50,7 +50,7 @@
it("can be used to replay conversations",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
_converse.allow_non_roster_messaging = true;
......
......@@ -12,7 +12,7 @@
it("can be used to remove a contact",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
async function (done, _converse) {
test_utils.createContacts(_converse, 'current');
......@@ -45,7 +45,7 @@
it("shows an alert when an error happened while removing the contact",
mock.initConverse(
null, ['rosterGroupsFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'emojisInitialized'], {},
async function (done, _converse) {
test_utils.createContacts(_converse, 'current');
......
......@@ -182,7 +182,7 @@
Strophe.Connection = MockConnection;
async function initConverse (settings, spies={}) {
async function initConverse (settings) {
window.localStorage.clear();
window.sessionStorage.clear();
......@@ -198,10 +198,6 @@
'view_mode': mock.view_mode,
}, settings || {}));
if (spies && spies._converse) {
spies._converse.forEach(method => spyOn(_converse, method).and.callThrough());
}
_converse.ChatBoxViews.prototype.trimChat = function () {};
_converse.api.vcard.get = function (model, force) {
......@@ -244,15 +240,14 @@
return _converse;
}
mock.initConverse = function (spies={}, promise_names=[], settings=null, func) {
if (_.isFunction(spies)) {
func = spies;
spies = null;
mock.initConverse = function (promise_names=[], settings=null, func) {
if (_.isFunction(promise_names)) {
func = promise_names;
promise_names = []
settings = null;
}
return async done => {
const _converse = await initConverse(settings, spies);
const _converse = await initConverse(settings);
async function _done () {
if (_converse.api.connection.connected()) {
await _converse.api.user.logout();
......@@ -264,7 +259,12 @@
done();
}
await Promise.all((promise_names || []).map(_converse.api.waitUntil));
func(_done, _converse).catch(e => { fail(e); _done(); });
try {
await func(_done, _converse);
} catch(e) {
fail(e);
_done();
}
}
};
return mock;
......
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