Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for Transforming Decimal Trailing Zeroes to Exponent #58

Merged

Conversation

Ang-dot
Copy link
Contributor

@Ang-dot Ang-dot commented Dec 9, 2023

Actual frontend testing in local

image

Added updated test cases and passed all tests.

yarn run v1.22.19
$ jest
 PASS  src/test.js
  ✓ isCrypto (3ms)
  is crypto
    raw = true
      ✓ returns precision of 8 (13ms)
    raw = false
      ✓ returns formatted (3ms)
    noDecimal = true
      ✓ returns without decimal (1ms)
      ✓ returns decimal when less than 1 (1ms)
    abbreviated = true
      ✓ returns abbreviated format (EN) (1ms)
      ✓ returns abbreviated format (JA) (1ms)
  is fiat
    raw = true
      ✓ returns formatted raw (1ms)
    raw = false
      ✓ returns formatted with symbol (1ms)
    no decimal threshold
      ✓ returns decimal for amounts <= 100,000
      ✓ returns no decimal for amounts > 100,000 (1ms)
    noDecimal = true
      ✓ returns without decimal
      ✓ returns decimal when less than 1
    abbreviated = true
      ✓ returns abbreviated format (EN) (2ms)
      ✓ returns abbreviated format (JA) (1ms)
  Intl.NumberFormat not supported
    is BTC or ETH
      raw = true
        ✓ returns precision of 8
      raw = false
        ✓ returns currency with ISO Code (1ms)
    is fiat
      raw = true
        ✓ returns formatted raw (1ms)
      raw = false
        ✓ returns formatted with symbol (1ms)
  Format Currency correctly
    ✓ formats JPY correctly (1ms)
  Accepts object parameter
    ✓ defaults to noDecimal = false
    ✓ formats decimal places correctly (1ms)
    ✓ formats significant figures correctly (1ms)
    ✓ formats trailing decimal zeroes correctly (2ms)
    ✓ formats decimal places, significant figures and trailing decimal zeroes correctly (2ms)
    ✓ raw = true

Test Suites: 1 passed, 1 total
Tests:       26 passed, 26 total
Snapshots:   0 total
Time:        1.635s, estimated 2s
Ran all test suites.
✨  Done in 3.71s.

@Ang-dot Ang-dot force-pushed the yang-add-decimal-zeroes-exponent-formatting branch 3 times, most recently from f53df3f to c5e0f91 Compare December 11, 2023 01:50
package.json Outdated Show resolved Hide resolved
@ervinchai
Copy link
Contributor

Looks fine to me. Have we tested this against actual usages within the codebase? If yes, please attach screenshots!

@Ang-dot Ang-dot force-pushed the yang-add-decimal-zeroes-exponent-formatting branch from 31e2971 to da55ebd Compare December 11, 2023 05:14
@Ang-dot Ang-dot force-pushed the yang-add-decimal-zeroes-exponent-formatting branch from da55ebd to 5465eae Compare December 12, 2023 02:18
@Ang-dot Ang-dot force-pushed the yang-add-decimal-zeroes-exponent-formatting branch 2 times, most recently from a0ff565 to 2d14b79 Compare December 12, 2023 02:26
@Ang-dot Ang-dot changed the title Add Support for Turning Trailing Decimal Zeroes to Exponent Add Support for Transforming Decimal Trailing Zeroes to Exponent Dec 12, 2023
@Ang-dot Ang-dot force-pushed the yang-add-decimal-zeroes-exponent-formatting branch from 2d14b79 to 6366fe2 Compare December 12, 2023 02:30
@Ang-dot Ang-dot force-pushed the yang-add-decimal-zeroes-exponent-formatting branch from 6366fe2 to ff6f067 Compare December 12, 2023 02:32
@ervinchai
Copy link
Contributor

This looks good to me. Will hold off on merging first until we are sure that there are no edge cases. Will run this against develop branch! Thanks for the work, I'll take over from here!

Copy link
Contributor

@ervinchai ervinchai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ervinchai ervinchai merged commit 75fda8b into coingecko:master Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants