Convert Beenvoice to a Turborepo monorepo
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
/// <reference types="bun" />
|
||||
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import {
|
||||
EXPENSE_CATEGORIES,
|
||||
formatElapsedSeconds,
|
||||
getEffectiveInvoiceStatus,
|
||||
parseReceiptText,
|
||||
} from "../src";
|
||||
|
||||
describe("shared domain behavior", () => {
|
||||
test("exposes the expense category vocabulary", () => {
|
||||
expect(EXPENSE_CATEGORIES).toContain("Professional Services");
|
||||
});
|
||||
|
||||
test("calculates overdue status at day precision", () => {
|
||||
const yesterday = new Date();
|
||||
yesterday.setDate(yesterday.getDate() - 1);
|
||||
expect(getEffectiveInvoiceStatus("sent", yesterday)).toBe("overdue");
|
||||
expect(getEffectiveInvoiceStatus("paid", yesterday)).toBe("paid");
|
||||
});
|
||||
|
||||
test("formats elapsed time", () => {
|
||||
expect(formatElapsedSeconds(3_661)).toBe("01:01:01");
|
||||
});
|
||||
|
||||
test("extracts receipt totals and line items", () => {
|
||||
const receipt = parseReceiptText(
|
||||
"Corner Store\nCoffee 3.50\nSubtotal 3.50\nTax 0.31\nTotal 3.81",
|
||||
);
|
||||
expect(receipt.amount).toBe(3.81);
|
||||
expect(receipt.tax).toBe(0.31);
|
||||
expect(receipt.items[0]?.name).toBe("Coffee");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user