Page MenuHomePhabricator

D14082.id40885.diff
No OneTemporary

D14082.id40885.diff

diff --git a/apps/ecash-herald/src/utils.js b/apps/ecash-herald/src/utils.js
--- a/apps/ecash-herald/src/utils.js
+++ b/apps/ecash-herald/src/utils.js
@@ -135,7 +135,7 @@
// If xecAmount is between 1 billion and 1 trillion, return formatted + rounded
displayedAmount = xecAmount / 1000000000; // billions
descriptor = 'B';
- } else if (xecAmount > 1000000000000) {
+ } else if (xecAmount >= 1000000000000) {
// If xecAmount is greater than 1 trillion, return formatted + rounded
displayedAmount = xecAmount / 1000000000000;
descriptor = 'T';
diff --git a/apps/ecash-herald/test/utilsTests.js b/apps/ecash-herald/test/utilsTests.js
--- a/apps/ecash-herald/test/utilsTests.js
+++ b/apps/ecash-herald/test/utilsTests.js
@@ -189,6 +189,12 @@
it('formatXecAmount returns a rounded thousands string with no decimal places if 1000 < XEC amount < 1 million', async function () {
assert.strictEqual(formatXecAmount(555555.55), `556k XEC`);
});
+ it('formatXecAmount returns a string with no decimal places if XEC amount is 1 trillion', async function () {
+ assert.strictEqual(formatXecAmount(1000000000000), `1T XEC`);
+ });
+ it('formatXecAmount returns a rounded thousands string with no decimal places if 1000 < XEC amount < 1 million', async function () {
+ assert.strictEqual(formatXecAmount(555555.55), `556k XEC`);
+ });
it('formatXecAmount returns a rounded millions string with no decimal places if 1M < XEC amount < 1B', async function () {
assert.strictEqual(formatXecAmount(555555555.55), `556M XEC`);
});

File Metadata

Mime Type
text/plain
Expires
Tue, May 20, 18:59 (3 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5865452
Default Alt Text
D14082.id40885.diff (1 KB)

Event Timeline