* Find the discovery tool's wire `description` for this test's request only. * * The journal is shared across all parallel tests on the one aimock instance, * so entries are filtered by the test's `X-Test-Id` (the same header that * isolates fixture sequencing) before reading the catalog text.
(
request: import('@playwright/test').APIRequestContext,
aimockPort: number,
testId: string,
)
| 39 | * isolates fixture sequencing) before reading the catalog text. |
| 40 | */ |
| 41 | async function discoveryDescription( |
| 42 | request: import('@playwright/test').APIRequestContext, |
| 43 | aimockPort: number, |
| 44 | testId: string, |
| 45 | ): Promise<string | undefined> { |
| 46 | const journalRes = await request.get( |
| 47 | `http://127.0.0.1:${aimockPort}/v1/_requests`, |
| 48 | ) |
| 49 | const entries = (await journalRes.json()) as Array<JournalEntry> |
| 50 | for (const entry of entries) { |
| 51 | if (entry.headers?.['x-test-id'] !== testId) continue |
| 52 | const discovery = entry.body?.tools?.find( |
| 53 | (t) => t.function?.name === DISCOVERY_TOOL_NAME, |
| 54 | ) |
| 55 | if (discovery?.function?.description) { |
| 56 | return discovery.function.description |
| 57 | } |
| 58 | } |
| 59 | return undefined |
| 60 | } |
| 61 | |
| 62 | test.describe('lazy tools — discovery catalog wire format', () => { |
| 63 | // No journal reset here: the shared aimock journal is filtered per-test by |
no test coverage detected