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

Commit

Permalink
feat: /api/v0/repo/version (#676)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonKrone authored and daviddias committed Jan 24, 2018
1 parent 2b1820b commit ecf70b9
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/repo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = (arg) => {

return {
gc: require('./gc')(send),
stat: require('./stat')(send)
stat: require('./stat')(send),
version: require('./version')(send)
}
}
16 changes: 16 additions & 0 deletions src/repo/version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict'

const promisify = require('promisify-es6')

module.exports = (send) => {
return promisify((opts, callback) => {
if (typeof (opts) === 'function') {
callback = opts
opts = {}
}
send({
path: 'repo/version',
qs: opts
}, callback)
})
}
17 changes: 17 additions & 0 deletions test/repo.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ describe('.repo', function () {
done()
})
})

it('.repo.version', (done) => {
ipfs.repo.version((err, res) => {
expect(err).to.not.exist()
expect(res).to.exist()
expect(res).to.have.a.property('Version')
done()
})
})
})

describe('Promise API', () => {
Expand All @@ -61,5 +70,13 @@ describe('.repo', function () {
expect(res).to.have.a.property('RepoSize')
})
})

it('.repo.version', () => {
return ipfs.repo.version()
.then(res => {
expect(res).to.exist()
expect(res).to.have.a.property('Version')
})
})
})
})

0 comments on commit ecf70b9

Please sign in to comment.