@@ -40,7 +40,7 @@ describe('exporter', () => {
4040
4141 const file = new UnixFS ( options . type , options . content )
4242
43- const node = await DAGNode . create ( file . marshal ( ) , options . links )
43+ const node = new DAGNode ( file . marshal ( ) , options . links )
4444 const cid = await ipld . put ( node , mc . DAG_PB , {
4545 cidVersion : 0 ,
4646 hashAlg : mh . names [ 'sha2-256' ]
@@ -104,7 +104,7 @@ describe('exporter', () => {
104104 links . push ( new DAGLink ( '' , child . node . size , child . cid ) )
105105 }
106106
107- const node = await DAGNode . create ( file . marshal ( ) , links )
107+ const node = new DAGNode ( file . marshal ( ) , links )
108108 const cid = await ipld . put ( node , mc . DAG_PB , {
109109 cidVersion : 1 ,
110110 hashAlg : mh . names [ 'sha2-256' ]
@@ -116,14 +116,8 @@ describe('exporter', () => {
116116 }
117117 }
118118
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 )
127121 } )
128122
129123 it ( 'ensure hash inputs are sanitized' , async ( ) => {
@@ -197,14 +191,14 @@ describe('exporter', () => {
197191 it ( 'exports a small file with links' , async ( ) => {
198192 const content = Buffer . from ( [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ] )
199193 const chunk1 = new UnixFS ( 'raw' , content . slice ( 0 , 5 ) )
200- const chunkNode1 = await DAGNode . create ( chunk1 . marshal ( ) )
194+ const chunkNode1 = new DAGNode ( chunk1 . marshal ( ) )
201195 const chunkCid1 = await ipld . put ( chunkNode1 , mc . DAG_PB , {
202196 cidVersion : 0 ,
203197 hashAlg : mh . names [ 'sha2-256' ]
204198 } )
205199
206200 const chunk2 = new UnixFS ( 'raw' , content . slice ( 5 ) )
207- const chunkNode2 = await DAGNode . create ( chunk2 . marshal ( ) )
201+ const chunkNode2 = new DAGNode ( chunk2 . marshal ( ) )
208202 const chunkCid2 = await ipld . put ( chunkNode2 , mc . DAG_PB , {
209203 cidVersion : 0 ,
210204 hashAlg : mh . names [ 'sha2-256' ]
@@ -214,7 +208,7 @@ describe('exporter', () => {
214208 file . addBlockSize ( 5 )
215209 file . addBlockSize ( 5 )
216210
217- const fileNode = await DAGNode . create ( file . marshal ( ) , [
211+ const fileNode = new DAGNode ( file . marshal ( ) , [
218212 new DAGLink ( '' , chunkNode1 . size , chunkCid1 ) ,
219213 new DAGLink ( '' , chunkNode2 . size , chunkCid2 )
220214 ] )
@@ -822,7 +816,7 @@ describe('exporter', () => {
822816 } )
823817
824818 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 )
826820
827821 try {
828822 await exporter ( cid , ipld )
@@ -839,7 +833,7 @@ describe('exporter', () => {
839833 const file = new UnixFS ( 'file' )
840834 file . addBlockSize ( 100 )
841835
842- const cid = await ipld . put ( await DAGNode . create ( file . marshal ( ) , [
836+ const cid = await ipld . put ( new DAGNode ( file . marshal ( ) , [
843837 new DAGLink ( '' , 100 , cborNodeCid )
844838 ] ) , mc . DAG_PB )
845839
0 commit comments