Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Beaudan committed Feb 20, 2019
1 parent dc67aaf commit 0516e69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions js/modules/loki_p2p_api.js
Expand Up @@ -34,6 +34,10 @@ class LokiP2pAPI extends EventEmitter {
pingTimer: null,
isOnline: false,
};
if (isPing) {
this.setContactOnline(pubKey);
return;
}
// Try ping
this.pingContact(pubKey);
return;
Expand Down
10 changes: 5 additions & 5 deletions libloki/test/node/loki_p2p_api_test.js
@@ -1,7 +1,7 @@
const { assert } = require('chai');
const LokiP2pAPI = require('../../../js/modules/loki_p2p_api');

describe('LocalLokiServer', () => {
describe('LokiP2pAPI', () => {
const usedKey = 'aPubKey';
const usedAddress = 'anAddress';
const usedPort = 'aPort';
Expand Down Expand Up @@ -64,16 +64,16 @@ describe('LocalLokiServer', () => {
usedKey,
usedAddress,
usedPort,
true
false
);
assert.isTrue(this.lokiP2pAPI.isOnline(usedKey));
assert.isFalse(this.lokiP2pAPI.isOnline(usedKey));
this.lokiP2pAPI.updateContactP2pDetails(
usedKey,
usedAddress,
usedPort,
false
true
);
assert.isFalse(this.lokiP2pAPI.isOnline(usedKey));
assert.isTrue(this.lokiP2pAPI.isOnline(usedKey));
});

it('Should set a contact as offline', () => {
Expand Down

0 comments on commit 0516e69

Please sign in to comment.