Converting one test case to try using describe directly.

This commit is contained in:
mike12345567 2024-11-18 16:56:11 +00:00
parent 668df22176
commit f25dd387b1
2 changed files with 3097 additions and 3116 deletions

File diff suppressed because it is too large Load Diff

View File

@ -35,7 +35,6 @@ const providers: Record<DatabaseName, DatasourceProvider> = {
} }
export interface DatasourceDescribeOpts { export interface DatasourceDescribeOpts {
name: string
only?: DatabaseName[] only?: DatabaseName[]
exclude?: DatabaseName[] exclude?: DatabaseName[]
} }
@ -103,15 +102,14 @@ function createDummyTest() {
} }
export function datasourceDescribe( export function datasourceDescribe(
opts: DatasourceDescribeOpts, opts: DatasourceDescribeOpts
cb: (args: DatasourceDescribeReturn) => void ): DatabaseName[] {
) {
if (process.env.DATASOURCE === "none") { if (process.env.DATASOURCE === "none") {
createDummyTest() createDummyTest()
return process.exit(0)
} }
const { name, only, exclude } = opts const { only, exclude } = opts
if (only && exclude) { if (only && exclude) {
throw new Error("you can only supply one of 'only' or 'exclude'") throw new Error("you can only supply one of 'only' or 'exclude'")
@ -130,36 +128,32 @@ export function datasourceDescribe(
if (databases.length === 0) { if (databases.length === 0) {
createDummyTest() createDummyTest()
return process.exit(0)
} }
describe.each(databases)(name, name => { return databases
const config = new TestConfiguration() }
afterAll(() => { export function datasourceProps(dbName: DatabaseName) {
config.end() const config = new TestConfiguration()
}) return {
config,
cb({ dsProvider: () => createDatasources(config, dbName),
name, isInternal: dbName === DatabaseName.SQS,
config, isExternal: dbName !== DatabaseName.SQS,
dsProvider: () => createDatasources(config, name), isSql: [
isInternal: name === DatabaseName.SQS, DatabaseName.MARIADB,
isExternal: name !== DatabaseName.SQS, DatabaseName.MYSQL,
isSql: [ DatabaseName.POSTGRES,
DatabaseName.MARIADB, DatabaseName.SQL_SERVER,
DatabaseName.MYSQL, DatabaseName.ORACLE,
DatabaseName.POSTGRES, ].includes(dbName),
DatabaseName.SQL_SERVER, isMySQL: dbName === DatabaseName.MYSQL,
DatabaseName.ORACLE, isPostgres: dbName === DatabaseName.POSTGRES,
].includes(name), isMongodb: dbName === DatabaseName.MONGODB,
isMySQL: name === DatabaseName.MYSQL, isMSSQL: dbName === DatabaseName.SQL_SERVER,
isPostgres: name === DatabaseName.POSTGRES, isOracle: dbName === DatabaseName.ORACLE,
isMongodb: name === DatabaseName.MONGODB, }
isMSSQL: name === DatabaseName.SQL_SERVER,
isOracle: name === DatabaseName.ORACLE,
})
})
} }
function getDatasource( function getDatasource(