(provider: string, dbName: string)
| 311 | } |
| 312 | |
| 313 | async function prepareDatabase(provider: string, dbName: string) { |
| 314 | if (provider === 'postgresql') { |
| 315 | invariant(dbName, 'dbName is required'); |
| 316 | const pgClient = new PGClient(TEST_PG_CONFIG); |
| 317 | await pgClient.connect(); |
| 318 | await pgClient.query(`DROP DATABASE IF EXISTS "${dbName}"`); |
| 319 | await pgClient.query(`CREATE DATABASE "${dbName}"`); |
| 320 | await pgClient.end(); |
| 321 | } else if (provider === 'mysql') { |
| 322 | invariant(dbName, 'dbName is required'); |
| 323 | const mysqlPool = createMysqlPool(TEST_MYSQL_CONFIG); |
| 324 | await mysqlPool.promise().query(`DROP DATABASE IF EXISTS \`${dbName}\``); |
| 325 | await mysqlPool.promise().query(`CREATE DATABASE \`${dbName}\``); |
| 326 | await mysqlPool.promise().end(); |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | export async function createPolicyTestClient<Schema extends SchemaDef>( |
| 331 | schema: Schema, |
no test coverage detected