MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / isDbAvailable

Function isDbAvailable

apps/api/tests/helpers/db.ts:41–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

39 : undefined);
40
41export const isDbAvailable = async (): Promise<boolean> => {
42 if (availabilityCache !== null) {
43 return availabilityCache;
44 }
45
46 if (explicitTestDatabaseUrl() === undefined) {
47 availabilityCache = false;
48
49 return availabilityCache;
50 }
51
52 try {
53 await db.execute(sql`SELECT 1`);
54 availabilityCache = true;
55 } catch {
56 availabilityCache = false;
57 }
58
59 return availabilityCache;
60};
61
62/**
63 * Skip-guard for integration tests. Use at the top of each test:

Callers 1

requireDbFunction · 0.85

Calls 1

explicitTestDatabaseUrlFunction · 0.85

Tested by

no test coverage detected