@@ -2144,7 +2144,7 @@ t('Does not try rollback when commit errors', async() => {
21442144} )
21452145
21462146t ( 'Last keyword used even with duplicate keywords' , async ( ) => {
2147- await sql `create table test (x int); `
2147+ await sql `create table test (x int)`
21482148 await sql `insert into test values(1)`
21492149 const [ { x } ] = await sql `
21502150 select
@@ -2153,7 +2153,37 @@ t('Last keyword used even with duplicate keywords', async() => {
21532153 where x in ${ sql ( [ 1 , 2 ] ) }
21542154 `
21552155
2156- return [ x , true ]
2156+ return [ x , true , await sql `drop table test` ]
2157+ } )
2158+
2159+ t ( 'Insert array with null' , async ( ) => {
2160+ await sql `create table test (x int[])`
2161+ await sql `insert into test ${ sql ( { x : [ 1 , null , 3 ] } ) } `
2162+ return [
2163+ 1 ,
2164+ ( await sql `select x from test` ) [ 0 ] . x [ 0 ] ,
2165+ await sql `drop table test`
2166+ ]
2167+ } )
2168+
2169+ t ( 'Insert array with undefined throws' , async ( ) => {
2170+ await sql `create table test (x int[])`
2171+ return [
2172+ 'UNDEFINED_VALUE' ,
2173+ await sql `insert into test ${ sql ( { x : [ 1 , undefined , 3 ] } ) } ` . catch ( e => e . code ) ,
2174+ await sql `drop table test`
2175+ ]
2176+ } )
2177+
2178+ t ( 'Insert array with undefined transform' , async ( ) => {
2179+ const sql = postgres ( { ...options , transform : { undefined : null } } )
2180+ await sql `create table test (x int[])`
2181+ await sql `insert into test ${ sql ( { x : [ 1 , undefined , 3 ] } ) } `
2182+ return [
2183+ 1 ,
2184+ ( await sql `select x from test` ) [ 0 ] . x [ 0 ] ,
2185+ await sql `drop table test`
2186+ ]
21572187} )
21582188
21592189; window . addEventListener ( "unload" , ( ) => Deno . exit ( process . exitCode ) )
0 commit comments