Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit eef5762

Browse files
author
Pedro Santos
committed
fix: repo stat for string values
1 parent 72fdc8c commit eef5762

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
"browser-process-platform": "~0.1.1",
110110
"cross-env": "^6.0.0",
111111
"go-ipfs-dep": "^0.4.22",
112-
"interface-ipfs-core": "^0.119.0",
112+
"interface-ipfs-core": "github:ipfs/interface-js-ipfs-core#test/add-human-option-test-repo-stat",
113113
"ipfsd-ctl": "^0.47.1",
114114
"nock": "^11.4.0",
115115
"stream-equal": "^1.1.1"

src/repo/stat.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
const promisify = require('promisify-es6')
44
const Big = require('bignumber.js')
55

6-
const transform = function (res, callback) {
6+
const transform = ({ human }) => (res, callback) => {
77
callback(null, {
8-
numObjects: new Big(res.NumObjects),
9-
repoSize: new Big(res.RepoSize),
8+
numObjects: human ? res.NumObjects : new Big(res.NumObjects),
9+
repoSize: human ? res.RepoSize : new Big(res.RepoSize),
1010
repoPath: res.RepoPath,
1111
version: res.Version,
12-
storageMax: new Big(res.StorageMax)
12+
storageMax: human ? res.StorageMax : new Big(res.StorageMax)
1313
})
1414
}
1515

@@ -23,6 +23,6 @@ module.exports = (send) => {
2323
send.andTransform({
2424
path: 'repo/stat',
2525
qs: opts
26-
}, transform, callback)
26+
}, transform(opts), callback)
2727
})
2828
}

test/interface.spec.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,14 @@ describe('interface-ipfs-core tests', () => {
247247
] : null
248248
})
249249

250-
tests.repo(defaultCommonFactory)
250+
tests.repo(defaultCommonFactory, {
251+
skip: [
252+
{
253+
name: 'should get human readable repo stats',
254+
reason: 'FIXME go-ipfs only has human option implemented for the cli'
255+
}
256+
]
257+
})
251258

252259
tests.stats(defaultCommonFactory)
253260

0 commit comments

Comments
 (0)