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(); });