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

Commit 550f955

Browse files
richardschneiderdaviddias
authored andcommittedDec 1, 2017
feat: agent version with package number (#1121)
* fix: add package version number to the agent version #1080 * test: adjust for new agent version
1 parent 9eda8a8 commit 550f955

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed
 

‎src/core/components/id.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const promisify = require('promisify-es6')
44
const setImmediate = require('async/setImmediate')
5+
const pkgversion = require('../../../package.json').version
56

67
module.exports = function id (self) {
78
return promisify((opts, callback) => {
@@ -18,7 +19,7 @@ module.exports = function id (self) {
1819
.map((ma) => ma.toString())
1920
.filter((ma) => ma.indexOf('ipfs') >= 0)
2021
.sort(),
21-
agentVersion: 'js-ipfs',
22+
agentVersion: `js-ipfs/${pkgversion}`,
2223
protocolVersion: '9000'
2324
}))
2425
})

‎test/http-api/extra/id.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ module.exports = (ctl) => {
1313
expect(err).to.not.exist()
1414
expect(result.id).to.equal(idResult.ID)
1515
expect(result.publicKey).to.equal(idResult.PublicKey)
16-
expect(result.agentVersion).to.equal(idResult.AgentVersion)
16+
const agentComponents = result.agentVersion.split('/')
17+
expect(agentComponents).lengthOf.above(1)
18+
expect(agentComponents[0]).to.equal(idResult.AgentVersion)
1719
expect(result.protocolVersion).to.equal(idResult.ProtocolVersion)
1820
done()
1921
})

‎test/http-api/spec/id.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ module.exports = (http) => {
1818
}, (res) => {
1919
expect(res.result.ID).to.equal(idResult.ID)
2020
expect(res.result.PublicKey).to.equal(idResult.PublicKey)
21-
expect(res.result.AgentVersion).to.equal(idResult.AgentVersion)
21+
const agentComponents = res.result.AgentVersion.split('/')
22+
expect(agentComponents).lengthOf.above(1)
23+
expect(agentComponents[0]).to.equal(idResult.AgentVersion)
2224
expect(res.result.ProtocolVersion).to.equal(idResult.ProtocolVersion)
2325
done()
2426
})

0 commit comments

Comments
 (0)
This repository has been archived.