@@ -8,21 +8,17 @@ const path = require('path')
8
8
const describeOnlineAndOffline = require ( '../utils/on-and-off' )
9
9
const ipfs = require ( '../utils/ipfs-exec' ) ( repoPath )
10
10
11
- describe ( 'files' , ( ) => {
11
+ describe . only ( 'files' , ( ) => {
12
12
describeOnlineAndOffline ( repoPath , ( ) => {
13
13
it ( 'cat' , ( ) => {
14
14
return ipfs ( 'files cat QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o' ) . then ( ( out ) => {
15
15
expect ( out ) . to . be . eql ( 'hello world' )
16
16
} )
17
17
} )
18
- it ( 'add alias' , ( done ) => {
19
- nexpect . spawn ( 'node' , [ process . cwd ( ) + '/src/cli/bin.js' , 'add' , 'src/init-files/init-docs/readme' ] , { env} )
20
- . run ( ( err , stdout , exitcode ) => {
21
- expect ( err ) . to . not . exist
22
- expect ( exitcode ) . to . equal ( 0 )
23
- expect ( stdout [ 0 ] ) . to . equal ( 'added QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB readme' )
24
- done ( )
25
- } )
18
+ it ( 'cat alias' , ( ) => {
19
+ return ipfs ( 'cat QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o' ) . then ( ( out ) => {
20
+ expect ( out ) . to . be . eql ( 'hello world' )
21
+ } )
26
22
} )
27
23
28
24
it ( 'get' , ( ) => {
@@ -41,6 +37,22 @@ describe('files', () => {
41
37
fs . unlinkSync ( file )
42
38
} )
43
39
} )
40
+ it ( 'get alias' , ( ) => {
41
+ return ipfs ( 'get QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o' ) . then ( ( out ) => {
42
+ expect ( out ) . to . be . eql (
43
+ 'Saving file(s) to QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o'
44
+ )
45
+
46
+ const file = path . join ( process . cwd ( ) , 'QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o' )
47
+ expect (
48
+ fs . readFileSync ( file ) . toString ( )
49
+ ) . to . be . eql (
50
+ 'hello world\n'
51
+ )
52
+
53
+ fs . unlinkSync ( file )
54
+ } )
55
+ } )
44
56
45
57
it ( 'add' , ( ) => {
46
58
return ipfs ( 'files add src/init-files/init-docs/readme' ) . then ( ( out ) => {
@@ -50,6 +62,14 @@ describe('files', () => {
50
62
} )
51
63
} )
52
64
65
+ it ( 'add alias' , ( ) => {
66
+ return ipfs ( 'files add src/init-files/init-docs/readme' ) . then ( ( out ) => {
67
+ expect ( out ) . to . be . eql (
68
+ 'added QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB readme'
69
+ )
70
+ } )
71
+ } )
72
+
53
73
it ( 'add recursively' , ( ) => {
54
74
return ipfs ( 'files add -r src/init-files/init-docs' ) . then ( ( out ) => {
55
75
expect ( out ) . to . be . eql ( [
0 commit comments