Add Oracle to executeQuery.spec.ts

This commit is contained in:
Sam Rose 2024-08-02 17:20:52 +01:00
parent bc797238aa
commit 1ce5b53409
No known key found for this signature in database
1 changed files with 9 additions and 19 deletions

View File

@ -1,27 +1,20 @@
import { Datasource, Query, SourceName } from "@budibase/types" import { Datasource, Query } from "@budibase/types"
import * as setup from "./utilities" import * as setup from "./utilities"
import { DatabaseName, getDatasource } from "../../integrations/tests/utils" import {
import knex, { Knex } from "knex" DatabaseName,
getDatasource,
knexClient,
} from "../../integrations/tests/utils"
import { Knex } from "knex"
import { generator } from "@budibase/backend-core/tests" import { generator } from "@budibase/backend-core/tests"
function getKnexClientName(source: SourceName) {
switch (source) {
case SourceName.MYSQL:
return "mysql2"
case SourceName.SQL_SERVER:
return "mssql"
case SourceName.POSTGRES:
return "pg"
}
throw new Error(`Unsupported source: ${source}`)
}
describe.each( describe.each(
[ [
DatabaseName.POSTGRES, DatabaseName.POSTGRES,
DatabaseName.MYSQL, DatabaseName.MYSQL,
DatabaseName.SQL_SERVER, DatabaseName.SQL_SERVER,
DatabaseName.MARIADB, DatabaseName.MARIADB,
DatabaseName.ORACLE,
].map(name => [name, getDatasource(name)]) ].map(name => [name, getDatasource(name)])
)("execute query action (%s)", (_, dsProvider) => { )("execute query action (%s)", (_, dsProvider) => {
let tableName: string let tableName: string
@ -35,10 +28,7 @@ describe.each(
const ds = await dsProvider const ds = await dsProvider
datasource = await config.api.datasource.create(ds) datasource = await config.api.datasource.create(ds)
client = knex({ client = await knexClient(ds)
client: getKnexClientName(ds.source),
connection: ds.config,
})
}) })
beforeEach(async () => { beforeEach(async () => {