From 7e8d88e5a829ff5d481b84e072e9cd9b993c7adf Mon Sep 17 00:00:00 2001 From: Mario Volke Date: Mon, 15 Sep 2014 17:19:36 +0200 Subject: [PATCH] updated tests for write ctrl --- test/unit/write-ctrl-test.js | 40 ++++++++---------------------------- 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/test/unit/write-ctrl-test.js b/test/unit/write-ctrl-test.js index 3492b7b..f076548 100644 --- a/test/unit/write-ctrl-test.js +++ b/test/unit/write-ctrl-test.js @@ -63,10 +63,11 @@ define(function(require) { expect(scope.state.writer.write).to.exist; expect(scope.state.writer.close).to.exist; expect(scope.verify).to.exist; - expect(scope.onAddressUpdate).to.exist; expect(scope.checkSendStatus).to.exist; expect(scope.updatePreview).to.exist; expect(scope.sendToOutbox).to.exist; + expect(scope.tagStyle).to.exist; + expect(scope.lookupAddressBook).to.exist; }); }); @@ -87,9 +88,7 @@ define(function(require) { scope.state.writer.write(); expect(scope.writerTitle).to.equal('New email'); - expect(scope.to).to.deep.equal([{ - address: '' - }]); + expect(scope.to).to.deep.equal([]); expect(scope.subject).to.equal(''); expect(scope.body).to.equal(''); expect(scope.ciphertextPreview).to.equal(undefined); @@ -121,8 +120,6 @@ define(function(require) { expect(scope.writerTitle).to.equal('Reply'); expect(scope.to).to.deep.equal([{ address: address, - }, { - address: '' }]); expect(scope.subject).to.equal('Re: ' + subject); expect(scope.body).to.contain(body); @@ -156,9 +153,7 @@ define(function(require) { scope.state.writer.write(re, null, true); expect(scope.writerTitle).to.equal('Forward'); - expect(scope.to).to.deep.equal([{ - address: '' - }]); + expect(scope.to).to.deep.equal([]); expect(scope.subject).to.equal('Fwd: ' + subject); expect(scope.body).to.contain(body); expect(scope.ciphertextPreview).to.be.undefined; @@ -171,29 +166,6 @@ define(function(require) { }); - describe('onAddressUpdate', function() { - var verifyMock; - - beforeEach(function() { - verifyMock = sinon.stub(scope, 'verify'); - }); - - afterEach(function() { - scope.verify.restore(); - }); - - it('should do nothing for normal address', function() { - var to = [{ - address: 'asdf@asdf.de' - }]; - scope.onAddressUpdate(to, 0); - - expect(to.length).to.equal(1); - expect(to[0].address).to.equal('asdf@asdf.de'); - expect(verifyMock.calledOnce).to.be.true; - }); - }); - describe('verify', function() { var checkSendStatusMock; @@ -205,6 +177,10 @@ define(function(require) { scope.checkSendStatus.restore(); }); + it('should do nothing if recipient is not provided', function() { + scope.verify(undefined); + }); + it('should not work for invalid email addresses', function() { var recipient = { address: ''