From 9db86f5e499eb027867e2998aa7f5f965677a64e Mon Sep 17 00:00:00 2001 From: David Dias Date: Fri, 23 Dec 2016 09:42:05 +0000 Subject: [PATCH] fix: bitswap wantlist stats --- src/cli/commands/bitswap/stat.js | 6 ++++++ test/cli/test-bitswap.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cli/commands/bitswap/stat.js b/src/cli/commands/bitswap/stat.js index 96727bacb4..f9e4b8a879 100644 --- a/src/cli/commands/bitswap/stat.js +++ b/src/cli/commands/bitswap/stat.js @@ -1,6 +1,7 @@ 'use strict' const utils = require('../../utils') +const CID = require('cids') module.exports = { command: 'stat', @@ -21,6 +22,11 @@ module.exports = { } stats.Wantlist = stats.Wantlist || [] + stats.Wantlist = stats.Wantlist.map((entry) => { + const buf = new Buffer(entry.cid.hash.data) + const cid = new CID(entry.cid.version, entry.cid.codec, buf) + return cid.toBaseEncodedString() + }) stats.Peers = stats.Peers || [] console.log(`bitswap status diff --git a/test/cli/test-bitswap.js b/test/cli/test-bitswap.js index f1c256a361..9589d402cf 100644 --- a/test/cli/test-bitswap.js +++ b/test/cli/test-bitswap.js @@ -10,7 +10,7 @@ const createTempNode = require('../utils/temp-node') const repoPath = require('./index').repoPath const ipfs = require('../utils/ipfs-exec')(repoPath) -describe.only('bitswap', () => { +describe('bitswap', () => { let node before((done) => {