mirror of
https://github.com/moparisthebest/mail
synced 2025-02-16 23:20:09 -05:00
[WO-745] Adapt changes in imap-client v0.8.0
This commit is contained in:
parent
9bee0f3def
commit
a177503bdd
@ -60,7 +60,7 @@
|
|||||||
"grunt-string-replace": "~1.0.0",
|
"grunt-string-replace": "~1.0.0",
|
||||||
"grunt-svgmin": "~1.0.0",
|
"grunt-svgmin": "~1.0.0",
|
||||||
"grunt-svgstore": "~0.3.4",
|
"grunt-svgstore": "~0.3.4",
|
||||||
"imap-client": "~0.7.0",
|
"imap-client": "~0.8.0",
|
||||||
"jquery": "~2.1.1",
|
"jquery": "~2.1.1",
|
||||||
"mailreader": "~0.4.0",
|
"mailreader": "~0.4.0",
|
||||||
"mocha": "^1.21.4",
|
"mocha": "^1.21.4",
|
||||||
|
@ -1218,20 +1218,19 @@ Email.prototype.onConnect = function(options, callback) {
|
|||||||
* It will discard the imap client and pgp mailer
|
* It will discard the imap client and pgp mailer
|
||||||
*/
|
*/
|
||||||
Email.prototype.onDisconnect = function(callback) {
|
Email.prototype.onDisconnect = function(callback) {
|
||||||
var self = this;
|
|
||||||
|
|
||||||
// logout of imap-client
|
// logout of imap-client
|
||||||
self._imapClient.logout(function() {
|
|
||||||
// ignore error, because it's not problem if logout fails
|
// ignore error, because it's not problem if logout fails
|
||||||
|
this._imapClient.stopListeningForChanges(function() {});
|
||||||
|
this._imapClient.logout(function() {});
|
||||||
|
|
||||||
|
// discard clients
|
||||||
|
this._account.online = false;
|
||||||
|
this._imapClient = undefined;
|
||||||
|
this._pgpMailer = undefined;
|
||||||
|
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
// discard clients
|
|
||||||
self._account.online = false;
|
|
||||||
self._imapClient = undefined;
|
|
||||||
self._pgpMailer = undefined;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -312,11 +312,12 @@ describe('Email DAO integration tests', function() {
|
|||||||
mailreader.startWorker.restore();
|
mailreader.startWorker.restore();
|
||||||
accountService.onConnect.restore();
|
accountService.onConnect.restore();
|
||||||
|
|
||||||
imapClient._client.close();
|
imapClient.stopListeningForChanges(function() {
|
||||||
imapClient._listeningClient.close();
|
imapClient.logout(function() {
|
||||||
|
|
||||||
userStorage.clear(done);
|
userStorage.clear(done);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('IMAP Integration Tests', function() {
|
describe('IMAP Integration Tests', function() {
|
||||||
beforeEach(function(done) {
|
beforeEach(function(done) {
|
||||||
|
@ -1875,13 +1875,18 @@ describe('Email DAO unit tests', function() {
|
|||||||
|
|
||||||
describe('#onDisconnect', function() {
|
describe('#onDisconnect', function() {
|
||||||
it('should discard imapClient and pgpMailer', function(done) {
|
it('should discard imapClient and pgpMailer', function(done) {
|
||||||
imapClientStub.logout.yieldsAsync();
|
imapClientStub.stopListeningForChanges.yields();
|
||||||
|
imapClientStub.logout.yields();
|
||||||
dao.onDisconnect(done);
|
|
||||||
|
|
||||||
|
dao.onDisconnect(function() {
|
||||||
|
expect(imapClientStub.stopListeningForChanges.calledOnce).to.be.true;
|
||||||
|
expect(imapClientStub.logout.calledOnce).to.be.true;
|
||||||
expect(dao._account.online).to.be.false;
|
expect(dao._account.online).to.be.false;
|
||||||
expect(dao._imapClient).to.not.exist;
|
expect(dao._imapClient).to.not.exist;
|
||||||
expect(dao._pgpMailer).to.not.exist;
|
expect(dao._pgpMailer).to.not.exist;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user