@@ -39,8 +39,7 @@ describe('ls', () => {
3939 expect ( files ) . to . have . lengthOf ( 1 ) . and . to . containSubset ( [ {
4040 cid : fileStat . cid ,
4141 name : fileName ,
42- size : BigInt ( data . byteLength ) ,
43- type : 'raw'
42+ path : filePath
4443 } ] )
4544 } )
4645
@@ -59,8 +58,7 @@ describe('ls', () => {
5958 expect ( files ) . to . have . lengthOf ( 1 ) . and . to . containSubset ( [ {
6059 cid : fileStat . cid ,
6160 name : fileName ,
62- size : BigInt ( data . byteLength ) ,
63- type : 'raw'
61+ path : filePath
6462 } ] )
6563 } )
6664
@@ -121,8 +119,8 @@ describe('ls', () => {
121119
122120 expect ( files ) . to . have . lengthOf ( 1 ) . and . to . containSubset ( [ {
123121 cid : fileStat . cid ,
124- size : BigInt ( data . byteLength ) ,
125- type : 'raw'
122+ name : fileName ,
123+ path : filePath
126124 } ] )
127125 } )
128126
@@ -135,10 +133,12 @@ describe('ls', () => {
135133
136134 expect ( files . length ) . to . equal ( fileCount )
137135
138- files . forEach ( file => {
136+ for ( const entry of files ) {
137+ const file = await fs . stat ( entry . path )
138+
139139 // should be a file
140140 expect ( file . type ) . to . equal ( 'raw' )
141- } )
141+ }
142142 } )
143143
144144 it ( 'lists a file inside a sharded directory directly' , async ( ) => {
@@ -179,67 +179,4 @@ describe('ls', () => {
179179 expect ( files . length ) . to . equal ( 1 )
180180 expect ( files . filter ( file => file . name === fileName ) ) . to . be . ok ( )
181181 } )
182-
183- it ( 'should list a basic entry' , async ( ) => {
184- const filePath = '/foo.txt'
185-
186- await fs . writeBytes ( Uint8Array . from ( [ 0 , 1 , 2 , 3 ] ) , filePath , {
187- rawLeaves : false ,
188- force : true
189- } )
190-
191- const files = await all ( fs . ls ( filePath ) )
192-
193- expect ( files ) . to . have . nested . property ( '[0].type' )
194- expect ( files ) . to . have . nested . property ( '[0].content' )
195-
196- const basicFiles = await all ( fs . ls ( filePath , {
197- extended : false
198- } ) )
199-
200- expect ( basicFiles ) . to . not . have . nested . property ( '[0].type' )
201- expect ( basicFiles ) . to . not . have . nested . property ( '[0].content' )
202- } )
203-
204- it ( 'lists basic files in a directory' , async ( ) => {
205- const dirName = 'bar'
206- const dirPath = `/${ dirName } `
207- const fileName = 'foo.txt'
208- const filePath = `${ dirPath } /${ fileName } `
209-
210- await fs . writeBytes ( Uint8Array . from ( [ 0 , 1 , 2 , 3 ] ) , filePath , {
211- rawLeaves : false ,
212- force : true
213- } )
214-
215- const files = await all ( fs . ls ( dirPath ) )
216-
217- expect ( files ) . to . have . nested . property ( '[0].type' )
218- expect ( files ) . to . have . nested . property ( '[0].content' )
219-
220- const basicFiles = await all ( fs . ls ( dirPath , {
221- extended : false
222- } ) )
223-
224- expect ( basicFiles ) . to . not . have . nested . property ( '[0].type' )
225- expect ( basicFiles ) . to . not . have . nested . property ( '[0].content' )
226- } )
227-
228- it ( 'lists basic contents of a sharded directory' , async ( ) => {
229- const shardedDirPath = '/sharded-dir'
230- const shardedDirCid = await createShardedDirectory ( blockstore )
231- await fs . cp ( shardedDirCid , shardedDirPath )
232-
233- const files = await all ( fs . ls ( shardedDirPath ) )
234-
235- expect ( files ) . to . have . nested . property ( '[0].type' )
236- expect ( files ) . to . have . nested . property ( '[0].content' )
237-
238- const basicFiles = await all ( fs . ls ( shardedDirPath , {
239- extended : false
240- } ) )
241-
242- expect ( basicFiles ) . to . not . have . nested . property ( '[0].type' )
243- expect ( basicFiles ) . to . not . have . nested . property ( '[0].content' )
244- } )
245182} )
0 commit comments