1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-22 08:52:15 -05:00

Fix tests for ui/css changes

This commit is contained in:
Tankred Hase 2014-04-24 16:45:09 +02:00
parent 2eff335680
commit 433cc58d0b
7 changed files with 36 additions and 18 deletions

View File

@ -79,7 +79,7 @@ define(function(require) {
})).yields();
scope.onError = function(err) {
expect(err.title).to.equal('Success');
expect(scope.state.account.open).to.be.false;
expect(scope.state.lightbox).to.equal(undefined);
expect(keychainMock.getUserKeyPair.calledOnce).to.be.true;
expect(dl.createDownload.calledOnce).to.be.true;
dl.createDownload.restore();

View File

@ -40,7 +40,6 @@ define(function(require) {
describe('scope variables', function() {
it('should be set correctly', function() {
expect(scope.fingerprint).to.equal('XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX');
expect(scope.state.contacts.open).to.be.false;
expect(scope.state.contacts.toggle).to.exist;
});
});

View File

@ -97,10 +97,13 @@ define(function(require) {
scope.passphrase = passphrase;
keychainMock.getUserKeyPair.withArgs(emailAddress).yields(new Error('asd'));
scope.confirmPassphrase();
scope.onError = function(err) {
expect(err.message).to.equal('asd');
expect(keychainMock.getUserKeyPair.calledOnce).to.be.true;
done();
};
expect(keychainMock.getUserKeyPair.calledOnce).to.be.true;
done();
scope.confirmPassphrase();
});
});
});

View File

@ -176,10 +176,14 @@ define(function(require) {
expect(state).to.equal(1);
expect(emailDaoMock.unlock.calledOnce).to.be.true;
scope.setState.restore();
done();
}
});
scope.onError = function(err) {
expect(err.message).to.equal('asd');
done();
};
scope.confirmPassphrase();
});
});

View File

@ -98,7 +98,7 @@ define(function(require) {
expect(keychainMock.getUserKeyPair.calledOnce).to.be.true;
});
it('should not work when keypair upload fails', function() {
it('should not work when keypair upload fails', function(done) {
scope.passphrase = passphrase;
scope.key = {
privateKeyArmored: 'b'
@ -113,6 +113,11 @@ define(function(require) {
errMsg: 'yo mamma.'
});
scope.onError = function(err) {
expect(err.errMsg).to.equal('yo mamma.');
done();
};
scope.confirmPassphrase();
expect(keychainMock.getUserKeyPair.calledOnce).to.be.true;
@ -120,7 +125,7 @@ define(function(require) {
expect(keychainMock.putUserKeyPair.calledOnce).to.be.true;
});
it('should not work when unlock fails', function() {
it('should not work when unlock fails', function(done) {
scope.passphrase = passphrase;
scope.key = {
privateKeyArmored: 'b'
@ -134,6 +139,11 @@ define(function(require) {
errMsg: 'yo mamma.'
});
scope.onError = function(err) {
expect(err.errMsg).to.equal('yo mamma.');
done();
};
scope.confirmPassphrase();
expect(scope.incorrect).to.be.true;
@ -141,13 +151,18 @@ define(function(require) {
expect(emailDaoMock.unlock.calledOnce).to.be.true;
});
it('should not work when keypair retrieval', function() {
it('should not work when keypair retrieval', function(done) {
scope.passphrase = passphrase;
keychainMock.getUserKeyPair.withArgs(emailAddress).yields({
errMsg: 'yo mamma.'
});
scope.onError = function(err) {
expect(err.errMsg).to.equal('yo mamma.');
done();
};
scope.confirmPassphrase();
expect(keychainMock.getUserKeyPair.calledOnce).to.be.true;

View File

@ -63,10 +63,8 @@ define(function(require) {
describe('initial state', function() {
it('should be well defined', function() {
expect(scope.state).to.exist;
expect(scope.state.nav.open).to.be.false;
expect(scope.state.lightbox).to.be.undefined;
expect(scope.account.folders).to.not.be.empty;
expect(scope.onError).to.exist;
expect(scope.openFolder).to.exist;
});
});

View File

@ -55,7 +55,7 @@ define(function(require) {
describe('scope variables', function() {
it('should be set correctly', function() {
expect(scope.state.writer).to.exist;
expect(scope.state.writer.open).to.be.false;
expect(scope.state.lightbox).to.be.undefined;
expect(scope.state.writer.write).to.exist;
expect(scope.state.writer.close).to.exist;
expect(scope.verify).to.exist;
@ -68,11 +68,11 @@ define(function(require) {
describe('close', function() {
it('should close the writer', function() {
scope.state.writer.open = true;
scope.state.lightbox = 'write';
scope.state.writer.close();
expect(scope.state.writer.open).to.be.false;
expect(scope.state.lightbox).to.be.undefined;
});
});
@ -200,7 +200,7 @@ define(function(require) {
keychainMock.getReceiverPublicKey.yields(null, {
userId: 'asdf@example.com'
});
scope.$apply = function() {
scope.$digest = function() {
expect(recipient.key).to.deep.equal({
userId: 'asdf@example.com'
});
@ -311,8 +311,7 @@ define(function(require) {
expect(outboxMock.put.calledOnce).to.be.true;
expect(emailDaoMock.sync.calledOnce).to.be.true;
expect(scope.state.writer.open).to.be.false;
expect(scope.state.lightbox).to.be.undefined;
expect(scope.replyTo.answered).to.be.true;
});
});