@@ -119,27 +119,30 @@ assert.strictEqual(finished, promisify(stream.finished));
119119{
120120 const streamObj = new Writable ( ) ;
121121 assert . strictEqual ( streamObj . listenerCount ( 'end' ) , 0 ) ;
122- finished ( streamObj , { cleanup : false } ) . then ( ( ) => {
122+ finished ( streamObj , { cleanup : false } ) . then ( common . mustCall ( ( ) => {
123123 assert . strictEqual ( streamObj . listenerCount ( 'end' ) , 1 ) ;
124- } ) ;
124+ } ) ) ;
125+ streamObj . end ( ) ;
125126}
126127
127128// Cleanup function should be called when cleanup is set to true
128129// listenerCount should be 0 after calling finish
129130{
130131 const streamObj = new Writable ( ) ;
131132 assert . strictEqual ( streamObj . listenerCount ( 'end' ) , 0 ) ;
132- finished ( streamObj , { cleanup : true } ) . then ( ( ) => {
133+ finished ( streamObj , { cleanup : true } ) . then ( common . mustCall ( ( ) => {
133134 assert . strictEqual ( streamObj . listenerCount ( 'end' ) , 0 ) ;
134- } ) ;
135+ } ) ) ;
136+ streamObj . end ( ) ;
135137}
136138
137139// Cleanup function should not be called when cleanup has not been set
138140// listenerCount should be 1 after calling finish
139141{
140142 const streamObj = new Writable ( ) ;
141143 assert . strictEqual ( streamObj . listenerCount ( 'end' ) , 0 ) ;
142- finished ( streamObj ) . then ( ( ) => {
144+ finished ( streamObj ) . then ( common . mustCall ( ( ) => {
143145 assert . strictEqual ( streamObj . listenerCount ( 'end' ) , 1 ) ;
144- } ) ;
146+ } ) ) ;
147+ streamObj . end ( ) ;
145148}
0 commit comments