seahaven-ap/packages/shared/src/invoice-status.test.ts
Adam Moussa 46b570352a
feat(shared): add payment ladder and CSV domain package (AP-13) (#11)
* feat(shared): add payment ladder and CSV domain package

Introduce @seahaven-ap/shared via npm workspaces so FE and future API share
payments-dashboard-compatible status ladders, pay-date helpers, and CSV headers.

* fix(web): build shared package before vite dev

Ensure fresh npm ci && npm run dev (and Playwright webServer) can resolve
@seahaven-ap/shared dist exports that are gitignored.
2026-08-10 19:28:02 -04:00

18 lines
725 B
TypeScript

import { describe, expect, it } from "vitest";
import { isReadyToPay, statusAfterPayRun, statusAfterPaymentCleared } from "./invoice-status.js";
describe("invoice status helpers", () => {
it("treats approved as Ready-to-Pay", () => {
expect(isReadyToPay("approved")).toBe(true);
expect(isReadyToPay("pending_approval")).toBe(false);
expect(isReadyToPay("scheduled")).toBe(false);
expect(isReadyToPay("paid")).toBe(false);
expect(isReadyToPay("rejected")).toBe(false);
expect(isReadyToPay("void")).toBe(false);
});
it("exposes post pay-run and cleared invoice statuses", () => {
expect(statusAfterPayRun()).toBe("scheduled");
expect(statusAfterPaymentCleared()).toBe("paid");
});
});