fix: accept euro sign and dot thousands separators in amounts, clearer loan capital error
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4837a5cf22
commit
c3c371aefe
4 files changed
+16
-4
No files matched your search
@@ -25,6 +25,14 @@ describe("parseEuro", () => {
|
||||
expect(parseEuro("0,5")).toBe(50);
|
||||
});
|
||||
|
||||
it("accepts a euro sign and dots as thousands separators", () => {
|
||||
expect(parseEuro("40 000 €")).toBe(4000000);
|
||||
expect(parseEuro("40000€")).toBe(4000000);
|
||||
expect(parseEuro("40.000")).toBe(4000000);
|
||||
expect(parseEuro("1.234.567")).toBe(123456700);
|
||||
expect(parseEuro("40.000,50")).toBe(4000050);
|
||||
});
|
||||
|
||||
it("rejects empty, zero, negative and malformed amounts", () => {
|
||||
for (const s of ["", "0", "0,00", "-5", "abc", "12,345", "1,2,3"]) expect(parseEuro(s)).toBeNull();
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user