Skip to content

Use null subunit for non-ISO currencies without a subunit - #535

Open
cpruijsen wants to merge 1 commit into
Shopify:mainfrom
cpruijsen:fix/issue-353
Open

cpruijsen wants to merge 1 commit into
Shopify:mainfrom
cpruijsen:fix/issue-353

Conversation

@cpruijsen

Copy link
Copy Markdown

Currencies without a subunit are represented two different ways depending on which file they come
from. currency_iso.yml leaves subunit unset for them, so it loads as nil; currency_non_iso.yml
writes subunit: '', which loads as an empty string. Callers that check the subunit therefore have to
handle both, and a truthiness check quietly gets it wrong for one of the two sources.

This drops the empty-string values for xfu and gbx, the two non-ISO entries with no subunit, so
they load as nil like their ISO counterparts. The loader spec gains a case pinning that, alongside
the existing assertion on the same file.

Fixes #353

XFU and GBX defined subunit as an empty string in currency_non_iso.yml,
while currencies without a subunit in currency_iso.yml (e.g. JPY) leave
subunit null. Align the non-ISO entries with that convention.

Fixes Shopify#353
@cpruijsen

Copy link
Copy Markdown
Author

I've signed the CLA.

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.

Inconsistency in representation when non-ISO currency does not have a subunit

1 participant