test: tighten bonjour callback assertions

This commit is contained in:
Peter Steinberger
2026-05-09 06:15:09 +01:00
parent 63926e749d
commit 1a08e77ded

View File

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