( prisma: FastifyTestInstance['prisma'] )
| 166 | ]; |
| 167 | |
| 168 | export async function checkCanConnectToDb( |
| 169 | prisma: FastifyTestInstance['prisma'] |
| 170 | ): Promise<void> { |
| 171 | const countP = prisma.user.count(); |
| 172 | const delayedRejection = new Promise((_resolve, reject) => |
| 173 | setTimeout( |
| 174 | () => reject(Error('unable to connect to Mongodb (timeout)')), |
| 175 | 1000 |
| 176 | ) |
| 177 | ); |
| 178 | await Promise.race([countP, delayedRejection]); |
| 179 | } |
| 180 | |
| 181 | export function setupServer(): void { |
| 182 | let fastify: FastifyTestInstance; |
no outgoing calls