@@ -11,16 +11,23 @@ const concat = require('concat-stream')
11
11
const through = require ( 'through2' )
12
12
13
13
module . exports = ( common ) => {
14
- describe ( '.files' , ( ) => {
14
+ describe . only ( '.files' , ( ) => {
15
15
let smallFile
16
16
let bigFile
17
+ let directoryContent
17
18
let ipfs
18
19
19
20
before ( ( done ) => {
20
- smallFile = fs . readFileSync ( path . join ( __dirname , './data/testfile.txt' )
21
- )
22
- bigFile = fs . readFileSync ( path . join ( __dirname , './data/15mb.random' )
23
- )
21
+ smallFile = fs . readFileSync ( path . join ( __dirname , './data/testfile.txt' ) )
22
+ bigFile = fs . readFileSync ( path . join ( __dirname , './data/15mb.random' ) )
23
+ directoryContent = {
24
+ 'pp.txt' : fs . readFileSync ( path . join ( __dirname , './data/test-folder/pp.txt' ) ) ,
25
+ 'holmes.txt' : fs . readFileSync ( path . join ( __dirname , './data/test-folder/holmes.txt' ) ) ,
26
+ 'jungle.txt' : fs . readFileSync ( path . join ( __dirname , './data/test-folder/jungle.txt' ) ) ,
27
+ 'alice.txt' : fs . readFileSync ( path . join ( __dirname , './data/test-folder/alice.txt' ) ) ,
28
+ 'files/hello.txt' : fs . readFileSync ( path . join ( __dirname , './data/test-folder/files/hello.txt' ) ) ,
29
+ 'files/ipfs.txt' : fs . readFileSync ( path . join ( __dirname , './data/test-folder/files/ipfs.txt' ) ) ,
30
+ }
24
31
25
32
common . setup ( ( err , _ipfs ) => {
26
33
expect ( err ) . to . not . exist
@@ -100,15 +107,9 @@ module.exports = (common) => {
100
107
} )
101
108
102
109
it ( 'add a nested dir as array' , ( done ) => {
103
- if ( ! isNode ) {
104
- return done ( )
105
- // can't run this test cause browserify
106
- // can't shim readFileSync in runtime
107
- }
108
- const base = path . join ( __dirname , 'data/test-folder' )
109
110
const content = ( name ) => ( {
110
111
path : `test-folder/${ name } ` ,
111
- content : fs . readFileSync ( path . join ( base , name ) )
112
+ content : directoryContent [ name ]
112
113
} )
113
114
const emptyDir = ( name ) => ( {
114
115
path : `test-folder/${ name } `
@@ -155,16 +156,9 @@ module.exports = (common) => {
155
156
156
157
describe ( '.createAddStream' , ( ) => {
157
158
it ( 'stream of valid files and dirs' , ( done ) => {
158
- if ( ! isNode ) {
159
- return done ( )
160
- // can't run this test cause browserify
161
- // can't shim readFileSync in runtime
162
- }
163
-
164
- const base = path . join ( __dirname , 'data/test-folder' )
165
159
const content = ( name ) => ( {
166
160
path : `test-folder/${ name } ` ,
167
- content : fs . readFileSync ( path . join ( base , name ) )
161
+ content : directoryContent [ name ]
168
162
} )
169
163
const emptyDir = ( name ) => ( {
170
164
path : `test-folder/${ name } `
0 commit comments