Simpl-Resultat/src
le king fu c88ebd862e
All checks were successful
PR Check — Frontend / frontend (pull_request) Successful in 1m43s
test: freeze CSV detection and amount parsing behaviour on a fixture corpus
First link of the import-format stack. `autoDetectConfig`, `detectAmountMode`,
`detectSingleAmount`, `preprocessQuotedCSV` and `parseFrenchAmount` had no test
at all on a suite of 871, while carrying every imported amount. This adds the
reference the rewrite (#323-#332) measures itself against, before any of it
moves.

Corpus — 11 synthetic files under `src/__fixtures__/csv/`, no real statement
data, covering shapes a single real statement never contains at once: signed
amount, debit/credit, debit/credit in reversed column order, unused column
filled with `0,00`, preamble before the header, header carrying a number,
header cell starting with digits, no header row, all-positive amounts,
whole-line-quoted (Desjardins style), absolute amount + D/C indicator.

Every expectation was derived by running the code, not by reading it. Four
cases are frozen as DEFECTIVE, each named `KNOWN DEFECT` with the right answer
in a comment and the issue that owes the fix:

- reversed debit/credit — the pair is assigned by column position, never by
  label, so every sign is inverted while the total merely negates (#328)
- unused column at `0,00` — the rule branches on `isNaN(credit)` and `"0,00"`
  parses to 0, so every debit imports as zero (#325)
- header cell starting with digits — `parseFloat` returns the numeric prefix,
  `detectHeader` reads the header as data (#328/#325)
- absolute amount + D/C indicator — the indicator column is ignored entirely
  and every credit imports as an expense (#328)

`parseFrenchAmount` is pinned form by form, including the prefix-scan defect
the spec flagged: `"100,00 CAD"` yields 10000 and passes `isNaN`. Per the
/review-spec revision, the assertions reach the holdings call sites too, which
surfaced the same x100 leak in the #245 holdings import — a price cell of
`"150,25 CAD"` stores the position at 15025.

The end-to-end tests replay the wizard's row-mapping rule from a mirror, since
it still lives inside a `useCallback` and the repo has no jsdom. A guard test
asserts the production expressions are still literally present, so the mirror
cannot drift; #325 extracts `mapRow` and must then delete it.

No production file is modified. 924 vitest green (was 871), build clean.

Resolves #326
2026-08-13 12:36:13 -04:00
..
__fixtures__ test: freeze CSV detection and amount parsing behaviour on a fixture corpus 2026-08-13 12:36:13 -04:00
__integration__ fix(db): serialize DB access to fix "database is locked"; live-update log console 2026-06-30 16:50:39 -04:00
components docs(gating): ADR 0017 + architecture + user guide + CHANGELOG 2026-07-20 22:48:55 -04:00
contexts fix(gating): keep key-validation errors out of the load lifecycle (#297) 2026-07-20 21:21:18 -04:00
data feat(categories): add v1 IPC seed, i18n keys, and migration v8 (#115) 2026-04-19 16:41:55 -04:00
hooks fix(gating): keep key-validation errors out of the load lifecycle (#297) 2026-07-20 21:21:18 -04:00
i18n fix(i18n): FR typo in docs.editions tier descriptions (#302) 2026-07-21 20:20:11 -04:00
pages feat(gating): multi-profile gate (Base+), non-destructive 2026-07-20 22:24:23 -04:00
services feat(gating): UI guard — RequireFeature + UpsellGate + i18n 2026-07-20 22:05:04 -04:00
shared feat(gating): multi-profile gate (Base+), non-destructive 2026-07-20 22:24:23 -04:00
utils test: freeze CSV detection and amount parsing behaviour on a fixture corpus 2026-08-13 12:36:13 -04:00
App.tsx feat(gating): gate routes and Sidebar for budget, advanced reports, balance 2026-07-20 22:12:51 -04:00
main.tsx feat(gating): license provider + entitlements matrix + useEntitlement (#297) 2026-07-19 21:05:10 -04:00
styles.css feat(categories): add categories standard guide page (#117) 2026-04-20 21:02:38 -04:00
vite-env.d.ts Initial project scaffold: Tauri v2 + React + TypeScript + TailwindCSS v4 2026-02-07 11:05:11 +00:00