MCPcopy Index your code
hub / github.com/freeCodeCamp/freeCodeCamp / checkCanConnectToDb

Function checkCanConnectToDb

api/vitest.utils.ts:168–179  ·  view source on GitHub ↗
(
  prisma: FastifyTestInstance['prisma']
)

Source from the content-addressed store, hash-verified

166];
167
168export 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
181export function setupServer(): void {
182 let fastify: FastifyTestInstance;

Callers 3

setupServerFunction · 0.85
setupServerFunction · 0.85
auth-dev.test.tsFile · 0.85

Calls

no outgoing calls

Tested by 1

setupServerFunction · 0.68