Skip to content

Commit 9fcfc2e

Browse files
committed
Add tests for dynamic schema and table name
1 parent 8ea6473 commit 9fcfc2e

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
@@ -880,6 +880,30 @@ t('Connection errors are caught using begin()', {
880880
]
881881
})
882882

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

0 commit comments

Comments
 (0)