From 1a08e77ded03f8da5428ba9de293cfe76f9b580c Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 9 May 2026 06:15:09 +0100 Subject: [PATCH] test: tighten bonjour callback assertions --- extensions/bonjour/src/advertiser.test.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/extensions/bonjour/src/advertiser.test.ts b/extensions/bonjour/src/advertiser.test.ts index a1bfed5b018..82e6038adb1 100644 --- a/extensions/bonjour/src/advertiser.test.ts +++ b/extensions/bonjour/src/advertiser.test.ts @@ -282,11 +282,10 @@ describe("gateway bonjour advertiser", () => { const started = await startAdvertiser({ gatewayPort: 18789 }); childProcessModule.exec('arp -a | findstr /C:"---"', () => {}); - expect(execMock).toHaveBeenCalledWith( - 'arp -a | findstr /C:"---"', - { windowsHide: true }, - expect.any(Function), - ); + const execCall = execMock.mock.calls[0]; + expect(execCall?.[0]).toBe('arp -a | findstr /C:"---"'); + expect(execCall?.[1]).toEqual({ windowsHide: true }); + expect(execCall?.[2]).toBeTypeOf("function"); await started.stop(); childProcessModule.exec('arp -a | findstr /C:"---"', () => {}); @@ -339,8 +338,11 @@ describe("gateway bonjour advertiser", () => { { logger }, ); - expect(processOn).toHaveBeenCalledWith("unhandledRejection", expect.any(Function)); - expect(processOn).not.toHaveBeenCalledWith("uncaughtException", expect.any(Function)); + const unhandledRejectionRegistration = processOn.mock.calls.find( + ([event]) => event === "unhandledRejection", + ); + expect(unhandledRejectionRegistration?.[1]).toBeTypeOf("function"); + expect(processOn.mock.calls.some(([event]) => event === "uncaughtException")).toBe(false); await started.stop(); });