mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
test(budget): match applySettlementUpdate's new settled_at SQL args
The unit test mocking db.run for applySettlementUpdate asserted the exact positional argument list, which the settled_at column added two more positions to (its CASE-WHEN flag and value, mirroring currency/exchange_rate).
This commit is contained in:
@@ -837,9 +837,10 @@ describe('applySettlementUpdate', () => {
|
||||
});
|
||||
|
||||
const res = budget.applySettlementUpdate(7, 1, { from_user_id: 2, to_user_id: 1, amount: 10.126 });
|
||||
// from, to, rounded amount, currency-flag(0)/value(null), rate-flag(null)/value(1), id.
|
||||
// No currency/exchange_rate passed → both CASE guards keep the existing columns.
|
||||
expect(run).toHaveBeenCalledWith(2, 1, 10.13, 0, null, null, 1, 7);
|
||||
// from, to, rounded amount, currency-flag(0)/value(null), rate-flag(null)/value(1),
|
||||
// settled_at-flag(0)/value(null), id.
|
||||
// No currency/exchange_rate/settled_at passed → all three CASE guards keep the existing columns.
|
||||
expect(run).toHaveBeenCalledWith(2, 1, 10.13, 0, null, null, 1, 0, null, 7);
|
||||
expect(res).toMatchObject({ id: 7, from_user_id: 2, to_user_id: 1, amount: 10.13 });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user