import { expect, test } from "vitest" import { BrokenBarrierError, CoordinationAbortError, CoordinationTimeoutError, } from "#Source/orchestration/index.ts" test("CoordinationAbortError stores operation, reason and formatted message", () => { const error = new CoordinationAbortError("Mutex acquire", "cancelled") expect(error.name).toBe("CoordinationAbortError") expect(error.operation).toBe("Mutex acquire") expect(error.reason).toBe("cancelled") expect(error.message).toBe("Mutex acquire aborted. cancelled") }) test("CoordinationTimeoutError stores operation, timeout and formatted message", () => { const error = new CoordinationTimeoutError("Semaphore acquire", 25) expect(error.name).toBe("CoordinationTimeoutError") expect(error.operation).toBe("Semaphore acquire") expect(error.timeout).toBe(25) expect(error.message).toBe("Semaphore acquire timeout after 25ms.") }) test("BrokenBarrierError stores reason and formatted message", () => { const error = new BrokenBarrierError("peer aborted") expect(error.name).toBe("BrokenBarrierError") expect(error.reason).toBe("peer aborted") expect(error.message).toBe("Barrier generation was broken by another participant. peer aborted") })