@@ -80,6 +80,33 @@ suite('data binding and mapping', () => {
8080 text : '' ,
8181 buf : new Uint8Array ( ) ,
8282 } ) ;
83+
84+ const nulls = { int : null , double : null , text : null , buf : null } ;
85+ const undefObj = {
86+ int : undefined ,
87+ double : undefined ,
88+ text : undefined ,
89+ buf : undefined ,
90+ } ;
91+ const insertAnon = db . prepare ( 'INSERT INTO types VALUES (?, ?, ?, ?, ?)' ) ;
92+ const insertNamed = db . prepare (
93+ 'INSERT INTO types VALUES ($key, $int, $double, $text, $buf)'
94+ ) ;
95+ t . assert . deepStrictEqual (
96+ insertAnon . run ( 6 , undefined , undefined , undefined , undefined ) ,
97+ { lastInsertRowid : 6 , changes : 1 } ,
98+ ) ;
99+ t . assert . deepStrictEqual (
100+ insertNamed . run ( { key : 7 , ...undefObj } ) ,
101+ { lastInsertRowid : 7 , changes : 1 } ,
102+ ) ;
103+ t . assert . deepStrictEqual (
104+ insertNamed . run ( { key : 8 } ) ,
105+ { lastInsertRowid : 8 , changes : 1 } ,
106+ ) ;
107+ t . assert . deepStrictEqual ( query . get ( 6 ) , { __proto__ : null , key : 6 , ...nulls } ) ;
108+ t . assert . deepStrictEqual ( query . get ( 7 ) , { __proto__ : null , key : 7 , ...nulls } ) ;
109+ t . assert . deepStrictEqual ( query . get ( 8 ) , { __proto__ : null , key : 8 , ...nulls } ) ;
83110 } ) ;
84111
85112 test ( 'large strings are bound correctly' , ( t ) => {
@@ -126,7 +153,6 @@ suite('data binding and mapping', () => {
126153 t . assert . strictEqual ( setup , undefined ) ;
127154
128155 [
129- undefined ,
130156 ( ) => { } ,
131157 Symbol ( ) ,
132158 / f o o / ,
0 commit comments