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', () => {
105
105
await trie . batch ( ops )
106
106
} )
107
107
108
- it ( 'should fetch all of the nodes' , ( ) => {
108
+ it ( 'should fetch all of the nodes' , async ( ) => {
109
109
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 ( )
113
113
assert . equal ( valObj [ key ] , value )
114
114
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 )
120
119
} )
121
120
} )
122
121
You can’t perform that action at this time.
0 commit comments