Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
feat: agent version with package number (#1121)
Browse files Browse the repository at this point in the history
* fix: add package version number to the agent version  #1080

* test: adjust for new agent version
  • Loading branch information
richardschneider authored and daviddias committed Dec 1, 2017
1 parent 9eda8a8 commit 550f955
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/core/components/id.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const promisify = require('promisify-es6')
const setImmediate = require('async/setImmediate')
const pkgversion = require('../../../package.json').version

module.exports = function id (self) {
return promisify((opts, callback) => {
Expand All @@ -18,7 +19,7 @@ module.exports = function id (self) {
.map((ma) => ma.toString())
.filter((ma) => ma.indexOf('ipfs') >= 0)
.sort(),
agentVersion: 'js-ipfs',
agentVersion: `js-ipfs/${pkgversion}`,
protocolVersion: '9000'
}))
})
Expand Down
4 changes: 3 additions & 1 deletion test/http-api/extra/id.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ module.exports = (ctl) => {
expect(err).to.not.exist()
expect(result.id).to.equal(idResult.ID)
expect(result.publicKey).to.equal(idResult.PublicKey)
expect(result.agentVersion).to.equal(idResult.AgentVersion)
const agentComponents = result.agentVersion.split('/')
expect(agentComponents).lengthOf.above(1)
expect(agentComponents[0]).to.equal(idResult.AgentVersion)
expect(result.protocolVersion).to.equal(idResult.ProtocolVersion)
done()
})
Expand Down
4 changes: 3 additions & 1 deletion test/http-api/spec/id.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ module.exports = (http) => {
}, (res) => {
expect(res.result.ID).to.equal(idResult.ID)
expect(res.result.PublicKey).to.equal(idResult.PublicKey)
expect(res.result.AgentVersion).to.equal(idResult.AgentVersion)
const agentComponents = res.result.AgentVersion.split('/')
expect(agentComponents).lengthOf.above(1)
expect(agentComponents[0]).to.equal(idResult.AgentVersion)
expect(res.result.ProtocolVersion).to.equal(idResult.ProtocolVersion)
done()
})
Expand Down

0 comments on commit 550f955

Please sign in to comment.