mirror of https://github.com/moparisthebest/mail
add login and destroy
This commit is contained in:
parent
1f89219353
commit
12860f6146
|
@ -117,24 +117,25 @@ define(function(require) {
|
||||||
// // IMAP Apis
|
// // IMAP Apis
|
||||||
// //
|
// //
|
||||||
|
|
||||||
|
EmailDAO.prototype.login = function(callback) {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
// login IMAP client if existent
|
||||||
|
self._imapClient.login(callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleanup by logging the user off.
|
||||||
|
*/
|
||||||
|
EmailDAO.prototype.destroy = function(callback) {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
self._imapClient.logout(callback);
|
||||||
|
};
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Login the imap client
|
// * Login the imap client
|
||||||
// */
|
// */
|
||||||
// EmailDAO.prototype.imapLogin = function(callback) {
|
|
||||||
// var self = this;
|
|
||||||
|
|
||||||
// // login IMAP client if existent
|
|
||||||
// self._imapClient.login(callback);
|
|
||||||
// };
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Cleanup by logging the user off.
|
|
||||||
// */
|
|
||||||
// EmailDAO.prototype.destroy = function(callback) {
|
|
||||||
// var self = this;
|
|
||||||
|
|
||||||
// self._imapClient.logout(callback);
|
|
||||||
// };
|
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * List the folders in the user's IMAP mailbox.
|
// * List the folders in the user's IMAP mailbox.
|
||||||
|
|
|
@ -217,5 +217,46 @@ define(function(require) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('login', function() {
|
||||||
|
it('should work', function(done) {
|
||||||
|
imapClientStub.login.yields();
|
||||||
|
|
||||||
|
dao.login(function(err) {
|
||||||
|
expect(err).to.not.exist;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should fail due to error in imap login', function(done) {
|
||||||
|
imapClientStub.login.yields({});
|
||||||
|
|
||||||
|
dao.login(function(err) {
|
||||||
|
expect(err).to.exist;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('destroy', function() {
|
||||||
|
it('should work', function(done) {
|
||||||
|
imapClientStub.logout.yields();
|
||||||
|
|
||||||
|
dao.destroy(function(err) {
|
||||||
|
expect(err).to.not.exist;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should fail due to error in imap login', function(done) {
|
||||||
|
imapClientStub.logout.yields({});
|
||||||
|
|
||||||
|
dao.destroy(function(err) {
|
||||||
|
expect(err).to.exist;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
Loading…
Reference in New Issue