You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, there are tests for looselyParseAmount and number formatting functions in util.test.ts, but none specifically for currencyToAmount. This is a critical utility function that handles currency string parsing throughout the application.
Objective
Add comprehensive unit tests for the currencyToAmount function covering:
Handling of different number formats (comma-dot, dot-comma, space-comma, apostrophe-dot, comma-dot-in)
Proper parsing of negative amounts (both with minus sign and parentheses)
Edge cases like leading zeros, only decimal part, etc.
Background
The
currencyToAmount
function inpackages/loot-core/src/shared/util.ts
has been the source of several bugs recently:Currently, there are tests for
looselyParseAmount
and number formatting functions inutil.test.ts
, but none specifically forcurrencyToAmount
. This is a critical utility function that handles currency string parsing throughout the application.Objective
Add comprehensive unit tests for the
currencyToAmount
function covering:Related PRs and Issues
Suggested Test Cases
Test cases should include but not be limited to:
.45
)This will help prevent regressions and ensure consistent behavior across the application.
The text was updated successfully, but these errors were encountered: