1+ /* eslint max-nested-callbacks: ["error", 5] */
12/* eslint-env mocha */
23'use strict'
34
5+ const os = require ( 'os' )
46const expect = require ( 'chai' ) . expect
7+ const repoVersion = require ( 'ipfs-repo' ) . repoVersion
58const pkgversion = require ( '../../package.json' ) . version
69const runOnAndOff = require ( '../utils/on-and-off' )
710
@@ -12,11 +15,55 @@ describe('version', () => runOnAndOff((thing) => {
1215 ipfs = thing . ipfs
1316 } )
1417
15- it ( 'get the version' , ( ) => {
16- return ipfs ( 'version' ) . then ( ( out ) => {
18+ it ( 'get the version' , ( ) =>
19+ ipfs ( 'version' ) . then ( out =>
1720 expect ( out ) . to . eql (
1821 `js-ipfs version: ${ pkgversion } \n`
1922 )
20- } )
23+ )
24+ )
25+
26+ it ( 'handles --number' , ( ) =>
27+ ipfs ( 'version --number' ) . then ( out =>
28+ expect ( out ) . to . eql ( `${ pkgversion } \n` )
29+ )
30+ )
31+
32+ it ( 'handles --commit' , ( ) =>
33+ ipfs ( 'version --commit' ) . then ( out =>
34+ expect ( out ) . to . eql ( `js-ipfs version: ${ pkgversion } -\n` )
35+ )
36+ )
37+
38+ describe ( 'handles --all' , function ( ) {
39+ it ( 'prints js-ipfs version' , ( ) =>
40+ ipfs ( 'version --all' ) . then ( out => {
41+ expect ( out ) . to . include ( `js-ipfs version: ${ pkgversion } ` )
42+ } )
43+ )
44+
45+ it ( 'prints repo version' , ( ) =>
46+ ipfs ( 'version --all' ) . then ( out => {
47+ expect ( out ) . to . include ( `Repo version: ${ repoVersion } ` )
48+ } )
49+ )
50+
51+ it ( 'prints arch/platform' , ( ) =>
52+ ipfs ( 'version --all' ) . then ( out => {
53+ expect ( out ) . to . include ( `System version: ${ os . arch ( ) } /${ os . platform ( ) } ` )
54+ } )
55+ )
56+
57+ it ( 'prints Node.js version' , ( ) =>
58+ ipfs ( 'version --all' ) . then ( out => {
59+ expect ( out ) . to . include ( `Node.js version: ${ process . version } ` )
60+ } )
61+ )
2162 } )
63+
64+ it ( 'handles --repo' , ( ) =>
65+ ipfs ( 'version --repo' ) . then ( out =>
66+ expect ( out ) . to . eql ( `${ repoVersion } \n` )
67+ )
68+ )
2269} ) )
0 commit comments