MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / waitForHit

Function waitForHit

e2e/resource-update.spec.ts:21–29  ·  view source on GitHub ↗

等待 mock server 收到某个 pathname 的请求

(server: MockServer, pathname: string, timeoutMs = 15_000)

Source from the content-addressed store, hash-verified

19
20/** 等待 mock server 收到某个 pathname 的请求 */
21async function waitForHit(server: MockServer, pathname: string, timeoutMs = 15_000): Promise<void> {
22 await expect
23 .poll(() => server.hits(pathname), {
24 message: `waiting for request to ${pathname} (got: ${JSON.stringify(server.requestLog.map((r) => r.pathname))})`,
25 timeout: timeoutMs,
26 intervals: [100, 250, 500, 1_000],
27 })
28 .toBeGreaterThan(0);
29}
30
31/**
32 * 打开目标页面并等待脚本输出哨兵 JSON 行。脚本注入相对安装存在异步窗口,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected