@@ -353,6 +353,7 @@ suite('DatabaseSync.prototype.close()', () => {
353353
354354 const select = db . prepare ( 'SELECT * FROM data' ) ;
355355 const insert = db . prepare ( 'INSERT INTO data (key, val) VALUES (?, ?)' ) ;
356+ const iterator = select . iterate ( ) ;
356357
357358 t . assert . strictEqual ( db . close ( ) , undefined ) ;
358359 t . assert . strictEqual ( db . isOpen , false ) ;
@@ -378,12 +379,24 @@ suite('DatabaseSync.prototype.close()', () => {
378379 code : 'ERR_INVALID_STATE' ,
379380 message : / s t a t e m e n t h a s b e e n f i n a l i z e d / ,
380381 } ) ;
382+ t . assert . throws ( ( ) => {
383+ select . iterate ( ) ;
384+ } , {
385+ code : 'ERR_INVALID_STATE' ,
386+ message : / s t a t e m e n t h a s b e e n f i n a l i z e d / ,
387+ } ) ;
381388 t . assert . throws ( ( ) => {
382389 insert . run ( 2 , 4 ) ;
383390 } , {
384391 code : 'ERR_INVALID_STATE' ,
385392 message : / s t a t e m e n t h a s b e e n f i n a l i z e d / ,
386393 } ) ;
394+ t . assert . throws ( ( ) => {
395+ iterator . next ( ) ;
396+ } , {
397+ code : 'ERR_INVALID_STATE' ,
398+ message : / s t a t e m e n t h a s b e e n f i n a l i z e d / ,
399+ } ) ;
387400 } ) ;
388401
389402 test ( 'keeps prepared statements invalid after reopening' , ( t ) => {
@@ -399,6 +412,7 @@ suite('DatabaseSync.prototype.close()', () => {
399412
400413 const select = db . prepare ( 'SELECT * FROM data' ) ;
401414 const insert = db . prepare ( 'INSERT INTO data (key, val) VALUES (?, ?)' ) ;
415+ const iterator = select . iterate ( ) ;
402416
403417 db . close ( ) ;
404418 db . open ( ) ;
@@ -415,12 +429,24 @@ suite('DatabaseSync.prototype.close()', () => {
415429 code : 'ERR_INVALID_STATE' ,
416430 message : / s t a t e m e n t h a s b e e n f i n a l i z e d / ,
417431 } ) ;
432+ t . assert . throws ( ( ) => {
433+ select . iterate ( ) ;
434+ } , {
435+ code : 'ERR_INVALID_STATE' ,
436+ message : / s t a t e m e n t h a s b e e n f i n a l i z e d / ,
437+ } ) ;
418438 t . assert . throws ( ( ) => {
419439 insert . run ( 2 , 4 ) ;
420440 } , {
421441 code : 'ERR_INVALID_STATE' ,
422442 message : / s t a t e m e n t h a s b e e n f i n a l i z e d / ,
423443 } ) ;
444+ t . assert . throws ( ( ) => {
445+ iterator . next ( ) ;
446+ } , {
447+ code : 'ERR_INVALID_STATE' ,
448+ message : / s t a t e m e n t h a s b e e n f i n a l i z e d / ,
449+ } ) ;
424450
425451 t . assert . deepStrictEqual (
426452 db . prepare ( 'SELECT * FROM data' ) . all ( ) ,
0 commit comments