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

Commit 754c0a4

Browse files
author
Pedro Santos
committed
fix: repo stat for string values
1 parent 4acd43e commit 754c0a4

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
@@ -108,7 +108,7 @@
108108
"browser-process-platform": "~0.1.1",
109109
"cross-env": "^6.0.0",
110110
"go-ipfs-dep": "^0.4.22",
111-
"interface-ipfs-core": "^0.117.2",
111+
"interface-ipfs-core": "github:ipfs/interface-js-ipfs-core#test/add-human-option-test-repo-stat",
112112
"ipfsd-ctl": "^0.47.1",
113113
"nock": "^11.4.0",
114114
"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
@@ -239,7 +239,14 @@ describe('interface-ipfs-core tests', () => {
239239
] : null
240240
})
241241

242-
tests.repo(defaultCommonFactory)
242+
tests.repo(defaultCommonFactory, {
243+
skip: [
244+
{
245+
name: 'should get human readable repo stats',
246+
reason: 'FIXME go-ipfs only has human option implemented for the cli'
247+
}
248+
]
249+
})
243250

244251
tests.stats(defaultCommonFactory)
245252

0 commit comments

Comments
 (0)