Make the spec independently testable

This commit is contained in:
JC Brand 2013-05-14 22:45:21 +02:00
parent d568d90a3a
commit 2a7031b504

View File

@ -343,8 +343,7 @@
describe("All Contacts", $.proxy(function () { describe("All Contacts", $.proxy(function () {
it("are saved to, and can be retrieved from, localStorage", $.proxy(function () { it("are saved to, and can be retrieved from, localStorage", $.proxy(function () {
var new_attrs, old_attrs, attrs, old_roster; var new_attrs, old_attrs, attrs, old_roster;
// One contact was declined, so we have 1 less contact then originally var num_contacts = this.roster.length;
expect(this.roster.length).toEqual(num_contacts-1);
new_roster = new this.RosterItems(); new_roster = new this.RosterItems();
// Roster items are yet to be fetched from localStorage // Roster items are yet to be fetched from localStorage
expect(new_roster.length).toEqual(0); expect(new_roster.length).toEqual(0);
@ -353,7 +352,7 @@
hex_sha1('converse.rosteritems-dummy@localhost')); hex_sha1('converse.rosteritems-dummy@localhost'));
new_roster.fetch(); new_roster.fetch();
expect(this.roster.length).toEqual(num_contacts-1); expect(this.roster.length).toEqual(num_contacts);
// Check that the roster items retrieved from localStorage // Check that the roster items retrieved from localStorage
// have the same attributes values as the original ones. // have the same attributes values as the original ones.
attrs = ['jid', 'fullname', 'subscription', 'ask']; attrs = ['jid', 'fullname', 'subscription', 'ask'];