1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-29 12:22:22 -05:00

fix error in tests

This commit is contained in:
Felix Hammerl 2014-03-11 16:57:14 +01:00
parent eb6c014354
commit 72794971da

View File

@ -37,8 +37,8 @@ define(function(require) {
var versionDbType = 'dbVersion'; var versionDbType = 'dbVersion';
it('should not update when up to date', function(done) { it('should not update when up to date', function(done) {
cfg.dbVersion = 3; // app requires database version 3 cfg.dbVersion = 10; // app requires database version 10
appConfigStorageStub.listItems.withArgs(versionDbType).yieldsAsync(null, '3'); // database version is 3 appConfigStorageStub.listItems.withArgs(versionDbType).yieldsAsync(null, ['10']); // database version is 10
updateHandler.update(function(error) { updateHandler.update(function(error) {
expect(error).to.not.exist; expect(error).to.not.exist;
@ -48,12 +48,12 @@ define(function(require) {
}); });
}); });
describe('dummy updates for v0 through v4', function() { describe('dummy updates for v2 to v4', function() {
var updateCounter; var updateCounter;
beforeEach(function() { beforeEach(function() {
updateCounter = 0; updateCounter = 0;
appConfigStorageStub.listItems.withArgs(versionDbType).yieldsAsync(); // database version is 0 appConfigStorageStub.listItems.withArgs(versionDbType).yieldsAsync(null, ['2']); // database version is 0
}); });
afterEach(function() { afterEach(function() {
@ -76,7 +76,7 @@ define(function(require) {
// execute test // execute test
updateHandler.update(function(error) { updateHandler.update(function(error) {
expect(error).to.not.exist; expect(error).to.not.exist;
expect(updateCounter).to.equal(4); expect(updateCounter).to.equal(2);
done(); done();
}); });
@ -91,7 +91,6 @@ define(function(require) {
} }
function failingUpdate(options, callback) { function failingUpdate(options, callback) {
updateCounter++;
callback({}); callback({});
} }
@ -101,7 +100,7 @@ define(function(require) {
// execute test // execute test
updateHandler.update(function(error) { updateHandler.update(function(error) {
expect(error).to.exist; expect(error).to.exist;
expect(updateCounter).to.equal(3); expect(updateCounter).to.equal(0);
done(); done();
}); });