@@ -8,56 +8,47 @@ if (isNode) {
8
8
testfile = require ( 'raw!../testfile.txt' )
9
9
}
10
10
11
- describe ( '.files' , function ( ) {
12
- it ( 'files.mkdir' , function ( done ) {
13
- this . timeout ( 20000 )
14
-
11
+ describe ( '.files' , ( ) => {
12
+ it ( 'files.mkdir' , ( done ) => {
15
13
apiClients [ 'a' ] . files . mkdir ( '/test-folder' , function ( err ) {
16
14
expect ( err ) . to . not . exist
17
15
done ( )
18
16
} )
19
17
} )
20
18
21
- it ( 'files.cp' , function ( done ) {
22
- this . timeout ( 20000 )
23
-
19
+ it ( 'files.cp' , ( done ) => {
24
20
apiClients [ 'a' ] . files
25
- . cp ( [ '/ipfs/Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP' , '/test-folder/test-file' ] , function ( err ) {
21
+ . cp ( [ '/ipfs/Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP' , '/test-folder/test-file' ] , ( err ) => {
26
22
expect ( err ) . to . not . exist
27
23
done ( )
28
24
} )
29
25
} )
30
26
31
- it ( 'files.ls' , function ( done ) {
32
- this . timeout ( 20000 )
33
-
34
- apiClients [ 'a' ] . files . ls ( '/test-folder' , function ( err , res ) {
27
+ it ( 'files.ls' , ( done ) => {
28
+ apiClients [ 'a' ] . files . ls ( '/test-folder' , ( err , res ) => {
35
29
expect ( err ) . to . not . exist
36
30
expect ( res . Entries . length ) . to . equal ( 1 )
37
31
done ( )
38
32
} )
39
33
} )
40
34
41
- it ( 'files.stat' , function ( done ) {
42
- this . timeout ( 20000 )
43
-
44
- apiClients [ 'a' ] . files . stat ( '/test-folder/test-file' , function ( err , res ) {
35
+ it ( 'files.stat' , ( done ) => {
36
+ apiClients [ 'a' ] . files . stat ( '/test-folder/test-file' , ( err , res ) => {
45
37
expect ( err ) . to . not . exist
46
38
expect ( res ) . to . deep . equal ( {
47
39
Hash : 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP' ,
48
40
Size : 12 ,
49
41
CumulativeSize : 20 ,
50
- Blocks : 0
42
+ Blocks : 0 ,
43
+ Type : 'file'
51
44
} )
52
45
53
46
done ( )
54
47
} )
55
48
} )
56
49
57
- it ( 'files.stat file that does not exist' , function ( done ) {
58
- this . timeout ( 20000 )
59
-
60
- apiClients [ 'a' ] . files . stat ( '/test-folder/does-not-exist' , function ( err , res ) {
50
+ it ( 'files.stat file that does not exist' , ( done ) => {
51
+ apiClients [ 'a' ] . files . stat ( '/test-folder/does-not-exist' , ( err , res ) => {
61
52
expect ( err ) . to . exist
62
53
if ( err . code === 0 ) {
63
54
return done ( )
@@ -66,24 +57,22 @@ describe('.files', function () {
66
57
} )
67
58
} )
68
59
69
- it ( 'files.read' , function ( done ) {
70
- this . timeout ( 20000 )
71
-
60
+ it ( 'files.read' , ( done ) => {
72
61
if ( ! isNode ) {
73
62
return done ( )
74
63
}
75
64
76
- apiClients [ 'a' ] . files . read ( '/test-folder/test-file' , function ( err , stream ) {
65
+ apiClients [ 'a' ] . files . read ( '/test-folder/test-file' , ( err , stream ) => {
77
66
expect ( err ) . to . not . exist
78
67
let buf = ''
79
68
stream
80
- . on ( 'error' , function ( err ) {
69
+ . on ( 'error' , ( err ) => {
81
70
expect ( err ) . to . not . exist
82
71
} )
83
- . on ( 'data' , function ( data ) {
72
+ . on ( 'data' , ( data ) => {
84
73
buf += data
85
74
} )
86
- . on ( 'end' , function ( ) {
75
+ . on ( 'end' , ( ) => {
87
76
expect ( new Buffer ( buf ) ) . to . deep . equal ( testfile )
88
77
done ( )
89
78
} )
@@ -92,10 +81,8 @@ describe('.files', function () {
92
81
93
82
// -
94
83
95
- it ( 'files.rm' , function ( done ) {
96
- this . timeout ( 20000 )
97
-
98
- apiClients [ 'a' ] . files . rm ( '/test-folder' , { 'recursive' : true } , function ( err ) {
84
+ it ( 'files.rm' , ( done ) => {
85
+ apiClients [ 'a' ] . files . rm ( '/test-folder' , { 'recursive' : true } , ( err ) => {
99
86
expect ( err ) . to . not . exist
100
87
done ( )
101
88
} )
0 commit comments