Skip to content

Commit

Permalink
tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
igalklebanov committed Nov 4, 2024
1 parent 2584335 commit bb86fad
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions test/node/src/with-schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,52 @@ for (const dialect of DIALECTS.filter(

await query.execute()
})

if (dialect === 'postgres') {
it('should not add schema for json_agg parameters', async () => {
const query = ctx.db
.withSchema('mammals')
.selectFrom('pet')
.select((eb) => [
eb.fn.jsonAgg('pet').as('one'),
eb.fn.jsonAgg(eb.table('pet')).as('two'),
])

testSql(query, dialect, {
postgres: {
sql: 'select json_agg("pet") as "one", json_agg("pet") as "two" from "mammals"."pet"',
parameters: [],
},
mysql: NOT_SUPPORTED,
mssql: NOT_SUPPORTED,
sqlite: NOT_SUPPORTED,
})

await query.execute()
})

it('should not add schema for to_json parameters', async () => {
const query = ctx.db
.withSchema('mammals')
.selectFrom('pet')
.select((eb) => [
eb.fn.toJson('pet').as('one'),
eb.fn.toJson(eb.table('pet')).as('two'),
])

testSql(query, dialect, {
postgres: {
sql: 'select to_json("pet") as "one", to_json("pet") as "two" from "mammals"."pet"',
parameters: [],
},
mysql: NOT_SUPPORTED,
mssql: NOT_SUPPORTED,
sqlite: NOT_SUPPORTED,
})

await query.execute()
})
}
})

describe('insert into', () => {
Expand Down

0 comments on commit bb86fad

Please sign in to comment.