@@ -41,6 +41,12 @@ const baseFiles = {
4141 size : 1258000 ,
4242 type : 'file' ,
4343 path : '1.2MiB.txt'
44+ } ,
45+ 'small.txt' : {
46+ cid : 'QmZMb7HWpbevpcdhbUV1ZZgdji8vh5uQ13KxczChGrK9Rd' ,
47+ size : 15 ,
48+ type : 'file' ,
49+ path : 'small.txt'
4450 }
4551}
4652
@@ -53,6 +59,12 @@ const strategyBaseFiles = {
5359 }
5460 } ) ,
5561 trickle : extend ( { } , baseFiles , {
62+ '200Bytes.txt' : {
63+ cid : 'QmY8bwnoKAKvJ8qtyPhWNxSS6sxiGVTJ9VpdQffs2KB5pE' ,
64+ size : 200 ,
65+ type : 'file' ,
66+ path : '200Bytes.txt'
67+ } ,
5668 '1.2MiB.txt' : {
5769 cid : 'QmfAxsHrpaLLuhbqqbo9KQyvQNawMnVSwutYoJed75pnco' ,
5870 type : 'file'
@@ -62,8 +74,8 @@ const strategyBaseFiles = {
6274
6375const strategies = [
6476 'flat' ,
65- 'balanced'
66- // 'trickle'
77+ 'balanced' ,
78+ 'trickle'
6779]
6880
6981const strategyOverrides = {
@@ -95,28 +107,52 @@ const strategyOverrides = {
95107 } ,
96108 trickle : {
97109 'foo-big' : {
98- cid : 'QmPh6KSS7ghTqzgWhaoCiLoHFPF7HGqUxx7q9vcM5HUN4U ' ,
110+ cid : 'QmaKbhFRy9kcCbcwrLsqYHWMiY44BDYkqTCMpAxDdd2du2 ' ,
99111 path : 'foo-big' ,
100112 size : 1334657 ,
101113 type : 'directory'
102114 } ,
103115 pim : {
104- cid : 'QmPAn3G2x2nrq4A1fu2XUpwWtpqG4D1YXFDrU615NHvJbr ' ,
116+ cid : 'QmbWGdnua4YuYpWJb7fE25PRbW9GbKKLqq9Ucmnsg2gxnt ' ,
105117 path : 'pim' ,
106118 size : 1334923 ,
107119 type : 'directory'
108120 } ,
109121 'pam/pum' : {
110- cid : 'QmPAn3G2x2nrq4A1fu2XUpwWtpqG4D1YXFDrU615NHvJbr ' ,
122+ cid : 'QmbWGdnua4YuYpWJb7fE25PRbW9GbKKLqq9Ucmnsg2gxnt ' ,
111123 path : 'pam/pum' ,
112124 size : 1334923 ,
113125 type : 'directory'
114126 } ,
115127 pam : {
116- cid : 'QmZTJah1xpG9X33ZsPtDEi1tYSHGDqQMRHsGV5xKzAR2j4 ' ,
128+ cid : 'QmSuh47G9Qm3PFv1zziojtHxqCjuurSdtWAzxLxoKJPq2U ' ,
117129 path : 'pam' ,
118130 size : 2669627 ,
119131 type : 'directory'
132+ } ,
133+ '200Bytes.txt with raw leaves' : {
134+ cid : 'QmagyRwMfYhczYNv5SvcJc8xxXjZQBTTHS2jEqNMva2mYT' ,
135+ size : 200 ,
136+ path : '200Bytes.txt' ,
137+ type : 'file'
138+ } ,
139+ 'foo/bar' : {
140+ cid : 'QmTGMxKPzSGNBDp6jhTwnZxGW6w1S9ciyycRJ4b2qcQaHK' ,
141+ size : 0 ,
142+ path : 'foo/bar' ,
143+ type : 'directory'
144+ } ,
145+ foo : {
146+ cid : 'Qme4A8fZmwfZESappfPcxSMTZVACiEzhHKtYRMuM1hbkDp' ,
147+ size : 0 ,
148+ path : 'foo' ,
149+ type : 'directory'
150+ } ,
151+ 'small.txt' : {
152+ cid : 'QmXmZ3qT328JxWtQXqrmvma2FmPp7tMdNiSuYvVJ5QRhKs' ,
153+ size : 15 ,
154+ type : 'file' ,
155+ path : 'small.txt'
120156 }
121157 }
122158}
@@ -301,7 +337,7 @@ strategies.forEach((strategy) => {
301337
302338 expect ( files . length ) . to . eql ( 1 )
303339
304- // always yield empty node
340+ // always yield empty file node
305341 expect ( files [ 0 ] . cid . toBaseEncodedString ( ) ) . to . eql ( 'QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH' )
306342 } )
307343
@@ -379,12 +415,14 @@ strategies.forEach((strategy) => {
379415 } )
380416
381417 it ( 'small file as string (smaller than a chunk)' , async ( ) => {
382- const file = await first ( importer ( [ {
383- path : '200Bytes .txt' ,
418+ const files = await all ( importer ( [ {
419+ path : 'small .txt' ,
384420 content : 'this is a file\n'
385421 } ] , ipld , options ) )
386422
387- expect ( file . cid . toBaseEncodedString ( ) ) . to . equal ( 'QmZMb7HWpbevpcdhbUV1ZZgdji8vh5uQ13KxczChGrK9Rd' )
423+ expectFiles ( files , [
424+ 'small.txt'
425+ ] )
388426 } )
389427
390428 it ( 'small file (smaller than a chunk) with raw leaves' , async ( ) => {
0 commit comments