Add savings chat analysis feature
This commit is contained in:
36
src/components/charts/CategoryBreakdownChart.test.ts
Normal file
36
src/components/charts/CategoryBreakdownChart.test.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
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",
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user