Repository navigation
fix: keep the sign of Splitwise balances on import - #806
jayhemnani9910 wants to merge 1 commit into
Conversation
The balance import parsed Splitwise amounts with toSafeBigInt's default signed=false, which drops the minus sign, so a balance the user owes was imported as money the friend owes them.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Importing friend balances from Splitwise drops the minus sign, so a balance you owe is imported as money the friend owes you.
Splitwise returns signed balance strings (
{"currency_code":"USD","amount":"-12.50"}).importUserBalanceFromSplitWiseparses them withtoSafeBigInt(balance.amount), andtoSafeBigIntstrips-unlesssignedis true, so-12.50and12.50both become1250and both create the same "friend owes me" expense. It now passessigned = true.Tests:
src/tests/splitwiseImport.test.tsimports a-12.50balance with the database mocked and checks the expense amounts; it fails before the change.jest --config jest.config.tspasses (521).This change was made with AI assistance, used to trace the cause and draft the test; I reviewed the diff and ran the tests myself.
Summary by CodeRabbit