浏览代码

Make the spec independently testable

JC Brand 12 年之前
父节点
当前提交
2a7031b504
共有 1 个文件被更改,包括 2 次插入3 次删除
  1. 2 3
      spec/MainSpec.js

+ 2 - 3
spec/MainSpec.js

@@ -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
-                    expect(this.roster.length).toEqual(num_contacts-1); 
+                    var num_contacts = this.roster.length;
                     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'];