File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -105,18 +105,17 @@ describe('kv stream test', () => {
105105 await trie . batch ( ops )
106106 } )
107107
108- it ( 'should fetch all of the nodes' , ( ) => {
108+ it ( 'should fetch all of the nodes' , async ( ) => {
109109 const stream = trie . createReadStream ( )
110- stream . on ( 'data' , ( d : any ) => {
111- const key = d . key . toString ( )
112- const value = d . value . toString ( )
110+ for await ( const chunk of stream ) {
111+ const key = chunk . key . toString ( )
112+ const value = chunk . value . toString ( )
113113 assert . equal ( valObj [ key ] , value )
114114 delete valObj [ key ]
115- } )
116- stream . on ( 'end' , ( ) => {
117- const keys = Object . keys ( valObj )
118- assert . equal ( keys . length , 0 )
119- } )
115+ }
116+
117+ const keys = Object . keys ( valObj )
118+ assert . equal ( keys . length , 0 )
120119 } )
121120} )
122121
You can’t perform that action at this time.
0 commit comments