Add an outline to the profiling tests.

This commit is contained in:
JC Brand 2014-10-24 22:24:05 +02:00
parent cdb86788a3
commit 6088417df7

View File

@ -15,42 +15,40 @@
converse.connection._changeConnectStatus(Strophe.Status.CONNECTED); converse.connection._changeConnectStatus(Strophe.Status.CONNECTED);
}); });
xit("adds contacts on presence stanza", $.proxy(function() { it("adds hundreds of contacts to the roster", $.proxy(function() {
}, converse));
it("adds hundreds of contacts to the roster, with roster groups", $.proxy(function() {
// XXX: Try with groups for now (might also add a test without groups)
converse.roster_groups = true;
spyOn(this.roster, 'clearCache').andCallThrough(); spyOn(this.roster, 'clearCache').andCallThrough();
expect(this.roster.pluck('jid').length).toBe(0); expect(this.roster.pluck('jid').length).toBe(0);
var stanza = $pres({from: 'data@enterprise/resource', type: 'subscribe'}); var stanza = $iq({
this.connection._dataRecv(test_utils.createRequest(stanza));
expect(this.roster.pluck('jid').length).toBe(1);
expect(_.contains(this.roster.pluck('jid'), 'data@enterprise')).toBeTruthy();
// Taken from the spec
// http://xmpp.org/rfcs/rfc3921.html#rfc.section.7.3
stanza = $iq({
to: this.connection.jid, to: this.connection.jid,
type: 'result', type: 'result',
id: 'roster_1' id: 'roster_1'
}).c('query', { }).c('query', {
xmlns: 'jabber:iq:roster', xmlns: 'jabber:iq:roster'
}).c('item', { });
jid: 'romeo@example.net',
name: 'Romeo', _.each(['Friends', 'Colleagues', 'Family', 'Acquaintances'], function (group) {
subscription:'both' var i, prefix = group.toLowerCase();
}).c('group').t('Friends').up().up() for (i=0; i<100; i++) {
.c('item', { stanza = stanza.c('item', {
jid: 'mercutio@example.org', jid: prefix+i+'@example.net',
name: 'Mercutio', subscription:'both'
subscription:'from' }).c('group').t('Friends').up().up();
}).c('group').t('Friends').up().up() }
.c('item', { });
jid: 'benvolio@example.org',
name: 'Benvolio',
subscription:'both'
}).c('group').t('Friends');
this.connection.roster._onReceiveRosterSuccess(null, stanza.tree()); this.connection.roster._onReceiveRosterSuccess(null, stanza.tree());
expect(this.roster.clearCache).toHaveBeenCalled(); expect(this.roster.clearCache).toHaveBeenCalled();
expect(_.contains(this.roster.pluck('jid'), 'data@enterprise')).toBeTruthy(); expect(this.roster.pluck('jid').length).toBe(400);
}, converse));
it("contacts in a very large roster change their statuses", $.proxy(function() {
}, converse)); }, converse));
}); });