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(outputReferences): sorting of token without references #1362

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

vprothais
Copy link

Fixes #1350 (at least for the outputReferences case)

Issue Summary:
When using the outputReferences option, the tokens output is in reversed order compared to the input order. This is due to the end of the sortByReference method which defines that A comes first by default.

Considering the following input :

orange-10
orange-20
orange-100

We end up with :

--colors-orange-100
--colors-orange-20
--colors-orange-10

Description of changes:
At the end of the sortByReference method I introduced a return 0 in order to keep original order for token without reference. I introduced a test for the case bUsesRefs to still have A_COMES_FIRST since it was the previous return value for this case.

I also added a unit test for the two tokens without reference case and had to update some snapshot because of the new order. I checked all generated snapshot and the token using a ref is always declared after the referenced token.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@vprothais vprothais requested a review from a team as a code owner October 7, 2024 12:48
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-1362.d16eby4ekpss5y.amplifyapp.com

Copy link
Collaborator

@jorenbroekema jorenbroekema left a comment

Choose a reason for hiding this comment

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

Aaaaaah so that's why! Good catch, thanks for contributing!

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.

Alphabetical order and outputReferences usage
2 participants