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

Commit

Permalink
fix(test): make the version test fetch the version from package.json …
Browse files Browse the repository at this point in the history
…instead of a hardcoded value
  • Loading branch information
daviddias committed Aug 11, 2016
1 parent eba0398 commit 50c9f7c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"form-data": "^1.0.0-rc4",
"gulp": "^3.9.1",
"idb-plus-blob-store": "^1.1.2",
"interface-ipfs-core": "^0.7.0",
"interface-ipfs-core": "^0.7.2",
"left-pad": "^1.1.1",
"lodash": "^4.14.1",
"ncp": "^2.0.0",
Expand Down
5 changes: 3 additions & 2 deletions test/cli/test-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const nexpect = require('nexpect')
const HttpAPI = require('../../src/http-api')
const repoPath = require('./index').repoPath
const _ = require('lodash')
const pkgversion = require('../../package.json').version

describe('version', () => {
const env = _.clone(process.env)
Expand All @@ -16,7 +17,7 @@ describe('version', () => {
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'version'], {env})
.run((err, stdout, exitcode) => {
expect(err).to.not.exist
expect(stdout[0]).to.equal('js-ipfs version: 0.14.1')
expect(stdout[0]).to.equal('js-ipfs version: ' + pkgversion)
expect(exitcode).to.equal(0)
done()
})
Expand Down Expand Up @@ -46,7 +47,7 @@ describe('version', () => {
.run((err, stdout, exitcode) => {
expect(err).to.not.exist
expect(exitcode).to.equal(0)
expect(stdout[0]).to.equal('js-ipfs version: 0.14.1')
expect(stdout[0]).to.equal('js-ipfs version: ' + pkgversion)
done()
})
})
Expand Down
3 changes: 2 additions & 1 deletion test/core/both/test-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'use strict'

const expect = require('chai').expect
const pkgversion = require('../../../package.json').version

const IPFS = require('../../../src/core')

Expand All @@ -16,7 +17,7 @@ describe('version', () => {
it('get version', (done) => {
ipfs.version((err, version) => {
expect(err).to.not.exist
expect(version).to.equal('0.14.1')
expect(version).to.equal(pkgversion)
done()
})
})
Expand Down
3 changes: 2 additions & 1 deletion test/http-api/test-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

const expect = require('chai').expect
const APIctl = require('ipfs-api')
const pkgversion = require('../../package.json').version

module.exports = (httpAPI) => {
describe('version', () => {
Expand All @@ -18,7 +19,7 @@ module.exports = (httpAPI) => {
method: 'GET',
url: '/api/v0/version'
}, (res) => {
expect(res.result.Version).to.equal('0.14.1')
expect(res.result.Version).to.equal(pkgversion)
expect(res.result).to.have.a.property('Commit')
expect(res.result).to.have.a.property('Repo')
done()
Expand Down

0 comments on commit 50c9f7c

Please sign in to comment.