This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree 2 files changed +27
-4
lines changed
2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
3
const Command = require ( 'ronin' ) . Command
4
- const IPFS = require ( '../../ipfs-core ' )
4
+ const utils = require ( '../utils ' )
5
5
const debug = require ( 'debug' )
6
6
const log = debug ( 'cli:version' )
7
7
log . error = debug ( 'cli:version:error' )
@@ -26,8 +26,8 @@ module.exports = Command.extend({
26
26
} ,
27
27
28
28
run : ( name ) => {
29
- var node = new IPFS ( )
30
- node . version ( ( err , version ) => {
29
+ var ipfs = utils . getIPFS ( )
30
+ ipfs . version ( ( err , version ) => {
31
31
if ( err ) { return log . error ( err ) }
32
32
33
33
console . log ( version )
Original file line number Diff line number Diff line change 2
2
3
3
const expect = require ( 'chai' ) . expect
4
4
const nexpect = require ( 'nexpect' )
5
+ const httpAPI = require ( '../../src/http-api' )
5
6
6
7
describe ( 'version' , ( ) => {
7
8
describe ( 'api offline' , ( ) => {
@@ -17,6 +18,28 @@ describe('version', () => {
17
18
} )
18
19
19
20
describe ( 'api running' , ( ) => {
20
- // TODO
21
+ before ( ( done ) => {
22
+ httpAPI . start ( ( err ) => {
23
+ expect ( err ) . to . not . exist
24
+ done ( )
25
+ } )
26
+ } )
27
+
28
+ after ( ( done ) => {
29
+ httpAPI . stop ( ( err ) => {
30
+ expect ( err ) . to . not . exist
31
+ done ( )
32
+ } )
33
+ } )
34
+
35
+ it ( 'get the version' , ( done ) => {
36
+ nexpect . spawn ( 'node' , [ process . cwd ( ) + '/src/cli/bin.js' , 'version' ] )
37
+ . expect ( '0.4.0-dev' )
38
+ . run ( ( err , stdout , exitcode ) => {
39
+ expect ( err ) . to . not . exist
40
+ expect ( exitcode ) . to . equal ( 0 )
41
+ done ( )
42
+ } )
43
+ } )
21
44
} )
22
45
} )
You can’t perform that action at this time.
0 commit comments