gift card balances: fix bug
gift card balances: fix bug: a task in smol-software-harbor (Harbor dataset). When a purchase costs more than what is left on a gift card, redeem() in src/cards.js charges the card correctly but leaves a negative balance, so the next purchase gets a refund. The balance must drop by the amount…
The task
When a purchase costs more than what is left on a gift card, `redeem()` in `src/cards.js` charges the card correctly but leaves a negative balance, so the next purchase gets a refund. The balance must drop by the amount actually charged and never go below zero. Fix it and run `node --test test/*.test.js`.
Part of efederici/smol-software-harbor.