@@ -25,6 +25,7 @@ const blockApi = require('./helpers/block')
25
25
const uint8ArrayFromString = require ( 'uint8arrays/from-string' )
26
26
const uint8ArrayToString = require ( 'uint8arrays/to-string' )
27
27
const uint8ArrayConcat = require ( 'uint8arrays/concat' )
28
+ const asAsyncIterable = require ( './helpers/as-async-iterable' )
28
29
29
30
const ONE_MEG = Math . pow ( 1024 , 2 )
30
31
@@ -79,7 +80,7 @@ describe('exporter', () => {
79
80
async function addTestFile ( { file, strategy = 'balanced' , path = '/foo' , maxChunkSize, rawLeaves } ) {
80
81
const result = await all ( importer ( [ {
81
82
path,
82
- content : file
83
+ content : asAsyncIterable ( file )
83
84
} ] , block , {
84
85
strategy,
85
86
rawLeaves,
@@ -195,7 +196,7 @@ describe('exporter', () => {
195
196
196
197
const files = await all ( importer ( [ {
197
198
path : filePath ,
198
- content : smallFile
199
+ content : asAsyncIterable ( smallFile )
199
200
} ] , block ) )
200
201
201
202
const path = `/ipfs/${ files [ 1 ] . cid . toBaseEncodedString ( ) } /${ fileName } `
@@ -211,7 +212,7 @@ describe('exporter', () => {
211
212
212
213
const files = await all ( importer ( [ {
213
214
path : filePath ,
214
- content : smallFile
215
+ content : asAsyncIterable ( smallFile )
215
216
} ] , block ) )
216
217
217
218
const path = `/ipfs/${ files [ 1 ] . cid . toBaseEncodedString ( ) } /${ fileName } `
@@ -613,7 +614,7 @@ describe('exporter', () => {
613
614
it ( 'exports a large file > 1mb imported with raw leaves' , async ( ) => {
614
615
const imported = await first ( importer ( [ {
615
616
path : '1.2MiB.txt' ,
616
- content : bigFile
617
+ content : asAsyncIterable ( bigFile )
617
618
} ] , block , {
618
619
rawLeaves : true
619
620
} ) )
@@ -890,7 +891,7 @@ describe('exporter', () => {
890
891
891
892
const imported = await first ( importer ( [ {
892
893
path : '200Bytes.txt' ,
893
- content : bigFile
894
+ content : asAsyncIterable ( bigFile )
894
895
} ] , block , {
895
896
rawLeaves : true
896
897
} ) )
@@ -915,7 +916,7 @@ describe('exporter', () => {
915
916
it ( 'exports a raw leaf' , async ( ) => {
916
917
const imported = await first ( importer ( [ {
917
918
path : '200Bytes.txt' ,
918
- content : smallFile
919
+ content : asAsyncIterable ( smallFile )
919
920
} ] , block , {
920
921
rawLeaves : true
921
922
} ) )
@@ -1022,7 +1023,7 @@ describe('exporter', () => {
1022
1023
it ( 'exports a node with depth' , async ( ) => {
1023
1024
const imported = await all ( importer ( [ {
1024
1025
path : '/foo/bar/baz.txt' ,
1025
- content : uint8ArrayFromString ( 'hello world' )
1026
+ content : asAsyncIterable ( uint8ArrayFromString ( 'hello world' ) )
1026
1027
} ] , block ) )
1027
1028
1028
1029
const exported = await exporter ( imported [ 0 ] . cid , ipld )
@@ -1033,13 +1034,13 @@ describe('exporter', () => {
1033
1034
it ( 'exports a node recursively with depth' , async ( ) => {
1034
1035
const dir = await last ( importer ( [ {
1035
1036
path : '/foo/bar/baz.txt' ,
1036
- content : uint8ArrayFromString ( 'hello world' )
1037
+ content : asAsyncIterable ( uint8ArrayFromString ( 'hello world' ) )
1037
1038
} , {
1038
1039
path : '/foo/qux.txt' ,
1039
- content : uint8ArrayFromString ( 'hello world' )
1040
+ content : asAsyncIterable ( uint8ArrayFromString ( 'hello world' ) )
1040
1041
} , {
1041
1042
path : '/foo/bar/quux.txt' ,
1042
- content : uint8ArrayFromString ( 'hello world' )
1043
+ content : asAsyncIterable ( uint8ArrayFromString ( 'hello world' ) )
1043
1044
} ] , block ) )
1044
1045
1045
1046
if ( ! dir ) {
0 commit comments