fix: format prices in notifications, change partial payment label, and add session holding notify API
This commit is contained in:
@@ -10,7 +10,8 @@ const {
|
||||
rialsToToman,
|
||||
isPaidTransaction,
|
||||
sumPaidTransactions,
|
||||
remainingPayable
|
||||
remainingPayable,
|
||||
formatPrice
|
||||
} = require('./paymentAmount');
|
||||
|
||||
describe('payment amount helpers', () => {
|
||||
@@ -40,6 +41,17 @@ describe('payment amount helpers', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('formatPrice', () => {
|
||||
it('formats numbers and numeric strings with decimal thousand separators', () => {
|
||||
assert.equal(formatPrice(8000000), '8,000,000');
|
||||
assert.equal(formatPrice('8000000'), '8,000,000');
|
||||
assert.equal(formatPrice(500000), '500,000');
|
||||
assert.equal(formatPrice(0), '0');
|
||||
assert.equal(formatPrice(''), '');
|
||||
assert.equal(formatPrice(null), '');
|
||||
});
|
||||
});
|
||||
|
||||
describe('rialsToToman', () => {
|
||||
it('drops one zero so spreadsheet Rials become website Toman', () => {
|
||||
assert.equal(rialsToToman(110_000_000), 11_000_000);
|
||||
|
||||
Reference in New Issue
Block a user