13 lines
552 B
TypeScript
13 lines
552 B
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { validateVoucher, formatEuro } from "../lib/vouchers";
|
|
describe("validateVoucher", () => {
|
|
it("lehnt negativen Rest und Rest über Wert ab", () => {
|
|
const base = { name: "X", anbieter: "Y", wertCents: 5000, restCents: 6000, ablaufdatum: null };
|
|
expect(validateVoucher(base)).toContain("restCents");
|
|
expect(validateVoucher({ ...base, restCents: -1 })).toContain("restCents");
|
|
});
|
|
it("formatEuro zeigt 25,50 €", () => {
|
|
expect(formatEuro(2550)).toContain("25,50");
|
|
});
|
|
});
|