Download src/infra/bonjour-ciao.test.ts from Darochin/openskynet: direct link, hf CLI and curl.
- Browser
- Download file 1.19 kB
-
https://huggingface.co/Darochin/openskynet/resolve/7e708f8da03fdeb42cb747523f87d1bed5cd0805/src/infra/bonjour-ciao.test.ts
- Command line
-
hf download hf://Darochin/openskynet@7e708f8da03fdeb42cb747523f87d1bed5cd0805/src/infra/bonjour-ciao.test.ts
-
curl -L -o bonjour-ciao.test.ts https://huggingface.co/Darochin/openskynet/resolve/7e708f8da03fdeb42cb747523f87d1bed5cd0805/src/infra/bonjour-ciao.test.ts
1.19 kB
| import { describe, expect, it, vi } from "vitest"; | |
| const logDebugMock = vi.hoisted(() => vi.fn()); | |
| vi.mock("../logger.js", () => ({ | |
| logDebug: (...args: unknown[]) => logDebugMock(...args), | |
| })); | |
| const { ignoreCiaoCancellationRejection } = await import("./bonjour-ciao.js"); | |
| describe("bonjour-ciao", () => { | |
| it("ignores and logs ciao cancellation rejections", () => { | |
| expect( | |
| ignoreCiaoCancellationRejection(new Error("Ciao announcement cancelled by shutdown")), | |
| ).toBe(true); | |
| expect(logDebugMock).toHaveBeenCalledWith( | |
| expect.stringContaining("ignoring unhandled ciao rejection"), | |
| ); | |
| }); | |
| it("ignores lower-case string cancellation reasons too", () => { | |
| logDebugMock.mockReset(); | |
| expect(ignoreCiaoCancellationRejection("ciao announcement cancelled during cleanup")).toBe( | |
| true, | |
| ); | |
| expect(logDebugMock).toHaveBeenCalledWith( | |
| expect.stringContaining("ignoring unhandled ciao rejection"), | |
| ); | |
| }); | |
| it("keeps unrelated rejections visible", () => { | |
| logDebugMock.mockReset(); | |
| expect(ignoreCiaoCancellationRejection(new Error("boom"))).toBe(false); | |
| expect(logDebugMock).not.toHaveBeenCalled(); | |
| }); | |
| }); | |