37 lines
834 B
TypeScript
37 lines
834 B
TypeScript
import { describe, expect, test } from "vitest";
|
|
import { toCategoryPieData } from "./categoryBreakdownData";
|
|
|
|
describe("toCategoryPieData", () => {
|
|
test("uses positive chart values while preserving signed expense amounts", () => {
|
|
expect(
|
|
toCategoryPieData([
|
|
{
|
|
name: "Lebensmittel",
|
|
amount: -123.45,
|
|
color: "#ef4444",
|
|
block: "variabel",
|
|
},
|
|
{
|
|
name: "Rueckerstattung",
|
|
amount: 12,
|
|
color: "#22c55e",
|
|
},
|
|
]),
|
|
).toEqual([
|
|
{
|
|
name: "Lebensmittel",
|
|
amount: -123.45,
|
|
chartAmount: 123.45,
|
|
color: "#ef4444",
|
|
block: "variabel",
|
|
},
|
|
{
|
|
name: "Rueckerstattung",
|
|
amount: 12,
|
|
chartAmount: 12,
|
|
color: "#22c55e",
|
|
},
|
|
]);
|
|
});
|
|
});
|