2015-10-25 18:49:35 +01:00
|
|
|
/*global converse */
|
2014-10-24 18:58:42 +02:00
|
|
|
(function (root, factory) {
|
|
|
|
define([
|
|
|
|
"jquery",
|
2015-10-25 18:49:35 +01:00
|
|
|
"underscore",
|
2014-10-24 18:58:42 +02:00
|
|
|
"mock",
|
|
|
|
"test_utils"
|
2015-10-25 18:49:35 +01:00
|
|
|
], function ($, _, mock, test_utils) {
|
|
|
|
return factory($, _, mock, test_utils);
|
2014-10-24 18:58:42 +02:00
|
|
|
}
|
|
|
|
);
|
2015-10-25 18:49:35 +01:00
|
|
|
} (this, function ($, _, mock, test_utils) {
|
2015-02-01 16:15:34 +01:00
|
|
|
var Strophe = converse_api.env.Strophe;
|
2015-05-01 14:34:20 +02:00
|
|
|
var $iq = converse_api.env.$iq;
|
2015-02-01 16:15:34 +01:00
|
|
|
|
2014-10-24 18:58:42 +02:00
|
|
|
describe("Profiling", function() {
|
|
|
|
beforeEach(function() {
|
2015-04-06 20:55:38 +02:00
|
|
|
test_utils.clearBrowserStorage();
|
|
|
|
converse.rosterview.model.reset();
|
2014-10-24 18:58:42 +02:00
|
|
|
converse.connection._changeConnectStatus(Strophe.Status.CONNECTED);
|
|
|
|
});
|
|
|
|
|
2014-10-27 23:06:11 +01:00
|
|
|
xit("adds hundreds of contacts to the roster", $.proxy(function() {
|
2014-10-26 17:12:59 +01:00
|
|
|
converse.roster_groups = false;
|
|
|
|
expect(this.roster.pluck('jid').length).toBe(0);
|
|
|
|
var stanza = $iq({
|
|
|
|
to: this.connection.jid,
|
|
|
|
type: 'result',
|
|
|
|
id: 'roster_1'
|
|
|
|
}).c('query', {
|
|
|
|
xmlns: 'jabber:iq:roster'
|
|
|
|
});
|
|
|
|
_.each(['Friends', 'Colleagues', 'Family', 'Acquaintances'], function (group) {
|
|
|
|
var i;
|
2015-05-01 14:34:20 +02:00
|
|
|
for (i=0; i<50; i++) {
|
2014-10-26 17:12:59 +01:00
|
|
|
stanza = stanza.c('item', {
|
|
|
|
jid: Math.random().toString().replace('0.', '')+'@example.net',
|
|
|
|
subscription:'both'
|
|
|
|
}).c('group').t(group).up().up();
|
|
|
|
}
|
|
|
|
});
|
2015-04-06 20:55:38 +02:00
|
|
|
this.roster.onReceivedFromServer(stanza.tree());
|
2015-05-01 14:34:20 +02:00
|
|
|
// expect(this.roster.pluck('jid').length).toBe(400);
|
2014-10-24 22:24:05 +02:00
|
|
|
}, converse));
|
|
|
|
|
2014-10-27 23:06:11 +01:00
|
|
|
xit("adds hundreds of contacts to the roster, with roster groups", $.proxy(function() {
|
2014-10-26 23:10:43 +01:00
|
|
|
// converse.show_only_online_users = true;
|
2014-10-24 22:24:05 +02:00
|
|
|
converse.roster_groups = true;
|
2014-10-24 18:58:42 +02:00
|
|
|
expect(this.roster.pluck('jid').length).toBe(0);
|
2014-10-24 22:24:05 +02:00
|
|
|
var stanza = $iq({
|
2014-10-24 18:58:42 +02:00
|
|
|
to: this.connection.jid,
|
|
|
|
type: 'result',
|
|
|
|
id: 'roster_1'
|
|
|
|
}).c('query', {
|
2014-10-24 22:24:05 +02:00
|
|
|
xmlns: 'jabber:iq:roster'
|
|
|
|
});
|
|
|
|
_.each(['Friends', 'Colleagues', 'Family', 'Acquaintances'], function (group) {
|
2014-10-25 12:33:08 +02:00
|
|
|
var i;
|
2014-10-26 23:11:58 +01:00
|
|
|
for (i=0; i<100; i++) {
|
2014-10-24 22:24:05 +02:00
|
|
|
stanza = stanza.c('item', {
|
2014-10-25 12:33:08 +02:00
|
|
|
jid: Math.random().toString().replace('0.', '')+'@example.net',
|
2014-10-24 22:24:05 +02:00
|
|
|
subscription:'both'
|
2014-10-25 12:33:08 +02:00
|
|
|
}).c('group').t(group).up().up();
|
2014-10-24 22:24:05 +02:00
|
|
|
}
|
|
|
|
});
|
2015-04-06 20:55:38 +02:00
|
|
|
this.roster.onReceivedFromServer(stanza.tree());
|
2014-10-26 23:10:43 +01:00
|
|
|
//expect(this.roster.pluck('jid').length).toBe(400);
|
2014-10-24 22:24:05 +02:00
|
|
|
}, converse));
|
2014-10-24 18:58:42 +02:00
|
|
|
});
|
|
|
|
}));
|