Skip to content

Commit

Permalink
feat: finish promisification
Browse files Browse the repository at this point in the history
  • Loading branch information
mkg20001 committed Jul 14, 2019
1 parent be8b7b8 commit ae3a1b1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"homepage": "https://github.com/mkg20001/interface-data-exchange#readme",
"dependencies": {},
"devDependencies": {
"aegir": "^19.0.4",
"interface-data-exchange-devdeps": "0.1.0"
"aegir": "^20.0.0",
"interface-data-exchange-devdeps": "0.1.2"
},
"contributors": [
"Maciej Krüger <[email protected]>"
Expand Down
4 changes: 2 additions & 2 deletions src/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ module.exports = (common) => {

it('request "test" b->a should fail', async () => {
try {
const result = exchangeB.request(peerA.peerInfo.id, 'test', Buffer.from(String(num)))
const result = await exchangeB.request(peerA.peerInfo.id, 'test', Buffer.from(String(num)))
expect(result).to.not.exist()
} catch (err) {
expect(err).to.exist()
Expand All @@ -72,7 +72,7 @@ module.exports = (common) => {

it('request to non-existent peer should fail', async () => {
try {
const result = exchangeB.request(peerE.id, 'test', Buffer.from(String(num)))
const result = await exchangeB.request(peerE.id, 'test', Buffer.from(String(num)))
expect(result).to.not.exist()
} catch (err) {
expect(err).to.exist()
Expand Down
3 changes: 1 addition & 2 deletions src/test/utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict'

const ids = require('./ids.json')
const promisify = require('promisify-es6')
const Id = require('peer-id')
const Peer = require('peer-info')

Expand All @@ -11,7 +10,7 @@ const MPLEX = require('libp2p-mplex')
const SECIO = require('libp2p-secio')

const createPeerInfo = async (id) => {
return new Peer(await promisify(Id.createFromJSON.bind(Id, ids[id]))())
return new Peer(await Id.createFromJSON(ids[id]))
}

const createPeer = async (id, opt) => {
Expand Down

0 comments on commit ae3a1b1

Please sign in to comment.