add money tracker
All checks were successful
Test and deploy staging / staging (push) Successful in 1m46s

This commit is contained in:
2026-09-23 17:02:32 +00:00
parent 753b2e5d6a
commit 0638ead87f
15 changed files with 2532 additions and 3 deletions

View File

@@ -0,0 +1,20 @@
import { describe, expect, it } from 'vitest';
import { cents, csvDate, parseCsv } from './money-tracker';
describe('transaction import parsing', () => {
it('handles quoted commas and semicolon-separated European amounts', () => {
expect(
parseCsv('date;account;description;amount\n23/09/2026;Cash;"Food; drinks";-12,50')[1]
).toEqual(['23/09/2026', 'Cash', 'Food; drinks', '-12,50']);
expect(
parseCsv('date,account,description,amount\n2026-09-23,Cash,"Food, drinks",-12.50')[1][2]
).toBe('Food, drinks');
expect(csvDate('23/09/2026')).toBe('2026-09-23');
expect(cents('-12,50')).toBe(-1250);
});
it('rejects invalid dates and amounts rather than altering them', () => {
expect(csvDate('31/02/2026')).toBeNull();
expect(cents('1.234,56')).toBeUndefined();
});
});