| 44 | // a JSON payload and exposes waitUntil so we can await the |
| 45 | // handler's async work. |
| 46 | function makePushEvent(payload: WebpushMessage) { |
| 47 | let waitUntilPromise: Promise<unknown> = Promise.resolve(); |
| 48 | return { |
| 49 | data: { |
| 50 | json: () => payload, |
| 51 | }, |
| 52 | waitUntil: (p: Promise<unknown>) => { |
| 53 | waitUntilPromise = p; |
| 54 | }, |
| 55 | // Expose the promise so tests can await it. |
| 56 | get _waitUntilPromise() { |
| 57 | return waitUntilPromise; |
| 58 | }, |
| 59 | }; |
| 60 | } |
| 61 | |
| 62 | const testPayload: WebpushMessage = { |
| 63 | title: "Test Notification", |