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

Fix number format tests #8538

Merged
merged 3 commits into from
Jul 23, 2019
Merged

Fix number format tests #8538

merged 3 commits into from
Jul 23, 2019

Conversation

asheemmamoowala
Copy link
Contributor

Closes #8537

Fixes two number-format expression tests errors and adds test-expressions to the test-suite script.

number-format/currency

In node v10, ICU was updated in a way that changed behavior of Intl.NumberFormat. To fix the discrepancy in output from Intl.NumberFormat , switch to using a supported locale en-US instead of specifying ja-JP/de-DE, which are not supported locales in default installations of node (with small-icu)

number-format/precision

The expression tests stripped decimal precision when testing number type values in deepEqual.

function deepEqual(a, b) {
if (typeof a !== typeof b)
return false;
if (typeof a === 'number') {
return stripPrecision(a) === stripPrecision(b);
}

This test is comparing string-ified number values, which does not strip precision. Since the test is validating that trailing 0s are added, I reduced the precision of the input number so that rounding differences in Intl.NumberFormat between node versions does not alter the test expectations.

  • briefly describe the changes in this PR
  • write tests for all new functionality
  • document any changes to public APIs
  • post benchmark scores
  • manually test the debug page
  • tagged @mapbox/studio and/or @mapbox/maps-design if this PR includes style spec changes
  • tagged @mapbox/gl-native if this PR includes shader changes or needs a native port

Asheem Mamoowala added 3 commits July 23, 2019 12:42
…cu implementations don't have support for ja and de locales. Use en-US locale for consistency and adjust expectations
…ferent rounding behavior in Intl.NumberFormat. The test is not trying to validate rounding behavior, so reduce post-decimal precision and adjust expectations
@asheemmamoowala asheemmamoowala merged commit ff3210a into master Jul 23, 2019
@asheemmamoowala asheemmamoowala deleted the fix-number-format-tests branch July 23, 2019 22:14
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.

Expression test failures with node v10
2 participants