MCPcopy Index your code
hub / github.com/coder/coder / makeNotificationClickEvent

Function makeNotificationClickEvent

site/src/serviceWorker.test.ts:255–270  ·  view source on GitHub ↗
(url?: string)

Source from the content-addressed store, hash-verified

253// Helper to build a minimal NotificationEvent-like object for
254// the notificationclick handler.
255function makeNotificationClickEvent(url?: string) {
256 let waitUntilPromise: Promise<unknown> = Promise.resolve();
257 return {
258 notification: {
259 close: vi.fn(),
260 data: url !== undefined ? { url } : undefined,
261 },
262 waitUntil: (p: Promise<unknown>) => {
263 waitUntilPromise = p;
264 },
265 // Expose the promise so tests can await it.
266 get _waitUntilPromise() {
267 return waitUntilPromise;
268 },
269 };
270}
271
272describe("serviceWorker notificationclick handler", () => {
273 it("focuses existing client without navigating when already on the target URL", async () => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected