Eliminate all console errors during test run
FREEBIE
This commit is contained in:
parent
f6c62e4822
commit
3cfac58d78
5 changed files with 38 additions and 16 deletions
|
@ -136,15 +136,16 @@
|
||||||
removePreKey: function(keyId) {
|
removePreKey: function(keyId) {
|
||||||
var prekey = new PreKey({id: keyId});
|
var prekey = new PreKey({id: keyId});
|
||||||
|
|
||||||
new Promise(function(resolve) {
|
return Promise.all([
|
||||||
getAccountManager().refreshPreKeys().then(resolve);
|
new Promise(function(resolve) {
|
||||||
});
|
getAccountManager().refreshPreKeys().then(resolve);
|
||||||
|
}),
|
||||||
return new Promise(function(resolve) {
|
new Promise(function(resolve) {
|
||||||
prekey.destroy().then(function() {
|
prekey.destroy().then(function() {
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Returns a signed keypair object or undefined */
|
/* Returns a signed keypair object or undefined */
|
||||||
|
|
|
@ -9,8 +9,10 @@
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
this.$el.hide();
|
this.$el.hide();
|
||||||
|
|
||||||
var renderIntervalHandle = setInterval(this.update.bind(this), 5000);
|
this.renderIntervalHandle = setInterval(this.update.bind(this), 5000);
|
||||||
extension.windows.onClosed(function () { clearInterval(renderIntervalHandle); });
|
extension.windows.onClosed(function () {
|
||||||
|
clearInterval(this.renderIntervalHandle);
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
setTimeout(this.finishConnectingGracePeriod.bind(this), 5000);
|
setTimeout(this.finishConnectingGracePeriod.bind(this), 5000);
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,14 @@
|
||||||
|
|
||||||
describe("Fixtures", function() {
|
describe("Fixtures", function() {
|
||||||
before(function(done) {
|
before(function(done) {
|
||||||
|
// NetworkStatusView checks this method every five seconds while showing
|
||||||
|
window.getSocketStatus = function() { return WebSocket.OPEN; };
|
||||||
|
|
||||||
Whisper.Fixtures.saveAll().then(function() {
|
Whisper.Fixtures.saveAll().then(function() {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renders', function(done) {
|
it('renders', function(done) {
|
||||||
ConversationController.updateInbox().then(function() {
|
ConversationController.updateInbox().then(function() {
|
||||||
var view = new Whisper.InboxView({appWindow: {contentWindow: window}});
|
var view = new Whisper.InboxView({appWindow: {contentWindow: window}});
|
||||||
|
@ -18,6 +22,6 @@ describe("Fixtures", function() {
|
||||||
var view = new Whisper.InboxView({appWindow: {contentWindow: window}});
|
var view = new Whisper.InboxView({appWindow: {contentWindow: window}});
|
||||||
view.$el.removeClass('android').addClass('android-dark');
|
view.$el.removeClass('android').addClass('android-dark');
|
||||||
view.$el.prependTo($('#render-android-dark'));
|
view.$el.prependTo($('#render-android-dark'));
|
||||||
}).then(done,done);
|
}).then(done, done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -91,9 +91,21 @@ describe("SignalProtocolStore", function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('removePreKey', function() {
|
describe('removePreKey', function() {
|
||||||
|
var oldGetAccountManager;
|
||||||
before(function(done) {
|
before(function(done) {
|
||||||
|
oldGetAccountManager = window.getAccountManager;
|
||||||
|
window.getAccountManager = function() {
|
||||||
|
return {
|
||||||
|
refreshPreKeys: function() {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
store.storePreKey(2, testKey).then(done);
|
store.storePreKey(2, testKey).then(done);
|
||||||
});
|
});
|
||||||
|
after(function() {
|
||||||
|
window.getAccountManager = oldGetAccountManager;
|
||||||
|
});
|
||||||
it('deletes prekeys', function(done) {
|
it('deletes prekeys', function(done) {
|
||||||
store.removePreKey(2, testKey).then(function() {
|
store.removePreKey(2, testKey).then(function() {
|
||||||
return store.loadPreKey(2).then(function(key) {
|
return store.loadPreKey(2).then(function(key) {
|
||||||
|
|
|
@ -25,13 +25,16 @@ describe('NetworkStatusView', function() {
|
||||||
});
|
});
|
||||||
/* END stubbing globals */
|
/* END stubbing globals */
|
||||||
|
|
||||||
beforeEach(function(done) {
|
beforeEach(function() {
|
||||||
|
|
||||||
networkStatusView = new Whisper.NetworkStatusView();
|
networkStatusView = new Whisper.NetworkStatusView();
|
||||||
$('.network-status-container').append(networkStatusView.el);
|
$('.network-status-container').append(networkStatusView.el);
|
||||||
// stubbing global
|
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
afterEach(function() {
|
||||||
|
// prevents huge number of errors on console after running tests
|
||||||
|
clearInterval(networkStatusView.renderIntervalHandle);
|
||||||
|
networkStatusView = null;
|
||||||
|
});
|
||||||
|
|
||||||
describe('initialization', function() {
|
describe('initialization', function() {
|
||||||
it('should have an empty interval', function() {
|
it('should have an empty interval', function() {
|
||||||
assert.equal(networkStatusView.socketReconnectWaitDuration.asSeconds(), 0);
|
assert.equal(networkStatusView.socketReconnectWaitDuration.asSeconds(), 0);
|
||||||
|
|
Loading…
Reference in a new issue