1
0
mirror of https://github.com/moparisthebest/mail synced 2025-02-16 15:10:10 -05:00

fix unit tests

This commit is contained in:
Tankred Hase 2013-11-21 15:45:18 +01:00
parent e13268625f
commit 50c48290d4
2 changed files with 9 additions and 22 deletions

View File

@ -36,7 +36,7 @@ define(function(require) {
}, function(err, status) {
expect(err).to.not.exist;
expect(status).to.equal(InvitationDAO.INVITE_SUCCESS);
expect(restDaoStub.put.calledWith(null, expectedUri)).to.be.true;
expect(restDaoStub.put.calledWith({}, expectedUri)).to.be.true;
done();
});
});
@ -90,12 +90,12 @@ define(function(require) {
invitationDao.invite({
recipient: alice,
}, expectError);
invitationDao.invite({
recipient: 123,
sender: 123
}, expectError);
invitationDao.invite('asd', expectError);
function expectError(err, status) {
@ -115,7 +115,10 @@ define(function(require) {
}, function(err, status) {
expect(err).to.not.exist;
expect(status).to.equal(InvitationDAO.INVITE_PENDING);
expect(restDaoStub.get.calledWith(null, expectedUri)).to.be.true;
expect(restDaoStub.get.calledWith({
uri: expectedUri,
type: 'text'
})).to.be.true;
done();
});
});
@ -172,12 +175,12 @@ define(function(require) {
invitationDao.check({
recipient: alice,
}, expectError);
invitationDao.check({
recipient: 123,
sender: 123
}, expectError);
invitationDao.check('asd', expectError);
function expectError(err, status) {

View File

@ -186,22 +186,6 @@ define(function(require) {
scope.sendToOutbox();
});
it('should not work if recipient does not have a public key', function(done) {
scope.state.writer.open = true;
scope.to = 'a, b, c';
scope.body = 'asd';
scope.subject = 'yaddablabla';
scope.onError = function(err) {
expect(err).to.exist;
expect(scope.state.writer.open).to.be.true;
expect(deviceStorageMock.storeList.called).to.be.false;
done();
};
scope.sendToOutbox();
});
it('should not work and not close the write view', function(done) {
scope.state.writer.open = true;
scope.to = 'a, b, c';