@@ -40,7 +40,7 @@ describe('exporter', () => {
40
40
41
41
const file = new UnixFS ( options . type , options . content )
42
42
43
- const node = await DAGNode . create ( file . marshal ( ) , options . links )
43
+ const node = new DAGNode ( file . marshal ( ) , options . links )
44
44
const cid = await ipld . put ( node , mc . DAG_PB , {
45
45
cidVersion : 0 ,
46
46
hashAlg : mh . names [ 'sha2-256' ]
@@ -104,7 +104,7 @@ describe('exporter', () => {
104
104
links . push ( new DAGLink ( '' , child . node . size , child . cid ) )
105
105
}
106
106
107
- const node = await DAGNode . create ( file . marshal ( ) , links )
107
+ const node = new DAGNode ( file . marshal ( ) , links )
108
108
const cid = await ipld . put ( node , mc . DAG_PB , {
109
109
cidVersion : 1 ,
110
110
hashAlg : mh . names [ 'sha2-256' ]
@@ -116,14 +116,8 @@ describe('exporter', () => {
116
116
}
117
117
}
118
118
119
- before ( ( done ) => {
120
- inMemory ( IPLD , ( err , resolver ) => {
121
- expect ( err ) . to . not . exist ( )
122
-
123
- ipld = resolver
124
-
125
- done ( )
126
- } )
119
+ before ( async ( ) => {
120
+ ipld = await inMemory ( IPLD )
127
121
} )
128
122
129
123
it ( 'ensure hash inputs are sanitized' , async ( ) => {
@@ -197,14 +191,14 @@ describe('exporter', () => {
197
191
it ( 'exports a small file with links' , async ( ) => {
198
192
const content = Buffer . from ( [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ] )
199
193
const chunk1 = new UnixFS ( 'raw' , content . slice ( 0 , 5 ) )
200
- const chunkNode1 = await DAGNode . create ( chunk1 . marshal ( ) )
194
+ const chunkNode1 = new DAGNode ( chunk1 . marshal ( ) )
201
195
const chunkCid1 = await ipld . put ( chunkNode1 , mc . DAG_PB , {
202
196
cidVersion : 0 ,
203
197
hashAlg : mh . names [ 'sha2-256' ]
204
198
} )
205
199
206
200
const chunk2 = new UnixFS ( 'raw' , content . slice ( 5 ) )
207
- const chunkNode2 = await DAGNode . create ( chunk2 . marshal ( ) )
201
+ const chunkNode2 = new DAGNode ( chunk2 . marshal ( ) )
208
202
const chunkCid2 = await ipld . put ( chunkNode2 , mc . DAG_PB , {
209
203
cidVersion : 0 ,
210
204
hashAlg : mh . names [ 'sha2-256' ]
@@ -214,7 +208,7 @@ describe('exporter', () => {
214
208
file . addBlockSize ( 5 )
215
209
file . addBlockSize ( 5 )
216
210
217
- const fileNode = await DAGNode . create ( file . marshal ( ) , [
211
+ const fileNode = new DAGNode ( file . marshal ( ) , [
218
212
new DAGLink ( '' , chunkNode1 . size , chunkCid1 ) ,
219
213
new DAGLink ( '' , chunkNode2 . size , chunkCid2 )
220
214
] )
@@ -822,7 +816,7 @@ describe('exporter', () => {
822
816
} )
823
817
824
818
it ( 'errors we export a non-unixfs dag-pb node' , async ( ) => {
825
- const cid = await ipld . put ( await DAGNode . create ( Buffer . from ( [ 0 , 1 , 2 , 3 , 4 ] ) ) , mc . DAG_PB )
819
+ const cid = await ipld . put ( new DAGNode ( Buffer . from ( [ 0 , 1 , 2 , 3 , 4 ] ) ) , mc . DAG_PB )
826
820
827
821
try {
828
822
await exporter ( cid , ipld )
@@ -839,7 +833,7 @@ describe('exporter', () => {
839
833
const file = new UnixFS ( 'file' )
840
834
file . addBlockSize ( 100 )
841
835
842
- const cid = await ipld . put ( await DAGNode . create ( file . marshal ( ) , [
836
+ const cid = await ipld . put ( new DAGNode ( file . marshal ( ) , [
843
837
new DAGLink ( '' , 100 , cborNodeCid )
844
838
] ) , mc . DAG_PB )
845
839
0 commit comments