Skip to content

Commit eeecc06

Browse files
committed
Add tests for dynamic schema and table name
1 parent 599d0e7 commit eeecc06

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/index.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,30 @@ t('Connection errors are caught using begin()', {
879879
]
880880
})
881881

882+
t('dynamic table name', async() => {
883+
await sql`create table test(a int)`
884+
return [
885+
0, (await sql`select * from ${ sql('test') }`).count,
886+
await sql`drop table test`
887+
]
888+
})
889+
890+
t('dynamic schema name', async() => {
891+
await sql`create table test(a int)`
892+
return [
893+
0, (await sql`select * from ${ sql('public') }.test`).count,
894+
await sql`drop table test`
895+
]
896+
})
897+
898+
t('dynamic schema and table name', async() => {
899+
await sql`create table test(a int)`
900+
return [
901+
0, (await sql`select * from ${ sql('public.test') }`).count,
902+
await sql`drop table test`
903+
]
904+
})
905+
882906
t('dynamic column name', async() => {
883907
return ['!not_valid', Object.keys((await sql`select 1 as ${ sql('!not_valid') }`)[0])[0]]
884908
})

0 commit comments

Comments
 (0)