import { type CommandContext } from "@tailor-platform/erp-kit/core"; import { expect } from "vitest"; export const commandCtx: CommandContext = { actorId: "test-actor", permissions: ["outbound-shipment:*"], }; interface OkResult { ok: true; value: T; } interface ErrResult { ok: false; error: unknown; } export function expectErr( result: OkResult | ErrResult, errorClass: abstract new (...args: never[]) => Error, ) { expect(result.ok).toBe(false); if (!result.ok) { expect(result.error).toBeInstanceOf(errorClass); } } export function expectOk(result: OkResult | ErrResult) { expect(result.ok).toBe(true); if (!result.ok) { throw result.error; } return result.value; }