MCPcopy
hub / github.com/promptfoo/promptfoo / enqueueTestDatabaseOperation

Function enqueueTestDatabaseOperation

src/database/testing.ts:15–25  ·  view source on GitHub ↗
(operation: () => Promise<T> | T)

Source from the content-addressed store, hash-verified

13}
14
15function enqueueTestDatabaseOperation<T>(operation: () => Promise<T> | T): Promise<T> {
16 const testGlobal = globalThis as TestDatabaseGlobal;
17 const result = (testGlobal[TEST_DATABASE_OPERATION_QUEUE_KEY] ?? Promise.resolve()).then(
18 operation,
19 );
20 testGlobal[TEST_DATABASE_OPERATION_QUEUE_KEY] = result.then(
21 () => undefined,
22 () => undefined,
23 );
24 return result;
25}
26
27export async function registerTestDatabaseClient(client: TestDatabaseClient): Promise<void> {
28 await enqueueTestDatabaseOperation(() => {

Callers 3

closeTestDatabaseClientFunction · 0.85
closeTestDatabaseClientsFunction · 0.85

Calls 1

resolveMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…