(adapter: SqlDriverAdapterFactory)
| 4 | import type { SqlDriverAdapterFactory } from '@prisma/driver-adapter-utils' |
| 5 | |
| 6 | export async function smokeTest(adapter: SqlDriverAdapterFactory) { |
| 7 | // wait for the database pool to be initialized |
| 8 | await setImmediate(0) |
| 9 | |
| 10 | // DEBUG='prisma:client:libraryEngine' |
| 11 | const prisma = new PrismaClient({ adapter }) |
| 12 | |
| 13 | console.log('[nodejs] connecting...') |
| 14 | await prisma.$connect() |
| 15 | console.log('[nodejs] connected') |
| 16 | |
| 17 | const test = new SmokeTest(prisma, adapter.provider) |
| 18 | |
| 19 | await test.testJSON() |
| 20 | await test.testTypeTest2() |
| 21 | await test.$raw() |
| 22 | await test.testFindManyTypeTest() |
| 23 | await test.transactionsWithConflits() |
| 24 | await test.testCreateAndDeleteChildParent() |
| 25 | await test.interactiveTransactions() |
| 26 | await test.explicitTransaction() |
| 27 | |
| 28 | console.log('[nodejs] disconnecting...') |
| 29 | await prisma.$disconnect() |
| 30 | console.log('[nodejs] disconnected') |
| 31 | |
| 32 | console.log('[nodejs] re-connecting...') |
| 33 | await prisma.$connect() |
| 34 | console.log('[nodejs] re-connecting') |
| 35 | |
| 36 | await setTimeout(0) |
| 37 | |
| 38 | console.log('[nodejs] re-disconnecting...') |
| 39 | await prisma.$disconnect() |
| 40 | console.log('[nodejs] re-disconnected') |
| 41 | } |
| 42 | |
| 43 | class SmokeTest { |
| 44 | constructor(private readonly prisma: PrismaClient, readonly provider: SqlDriverAdapterFactory['provider']) {} |
no test coverage detected