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

chore(auth): update tokenOrchestrator unit test exp token #13117

Merged

Conversation

ashwinkumar6
Copy link
Member

@ashwinkumar6 ashwinkumar6 commented Mar 13, 2024

Description of changes

tokenOrchestrator test is failing because of an expired token

  • Add required mock objects directly in tokenOrchestrator file rather than importing from another util file authAPITestParams
  • Hardcode expiredDate and futureDate instead of calling decodeJWT() util

Alternative:
Spying on decodeJWT() in authAPITestParams to achieve the same is complex because

  • authAPITestParams get's complied before the spy in test gets added to it. Would need to dynamically import authAPITestParams again in the test
  • decodeJWT gets called multiple times in a test, sometimes we can't have a standard mock value

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

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

@ashwinkumar6 ashwinkumar6 requested a review from a team as a code owner March 13, 2024 21:13
@ashwinkumar6 ashwinkumar6 force-pushed the tokenOrchestrator-token-fix branch from 375dc00 to 0e86c1c Compare March 13, 2024 21:26
israx
israx previously approved these changes Mar 13, 2024
ashika112
ashika112 previously approved these changes Mar 14, 2024
@ashwinkumar6 ashwinkumar6 dismissed stale reviews from ashika112 and israx via 0b7391f March 14, 2024 01:05
@ashwinkumar6 ashwinkumar6 force-pushed the tokenOrchestrator-token-fix branch 4 times, most recently from 8b736da to dc58311 Compare March 14, 2024 01:07
@ashwinkumar6 ashwinkumar6 force-pushed the tokenOrchestrator-token-fix branch from dc58311 to 3f248f1 Compare March 14, 2024 01:09
Copy link
Contributor

@kvramyasri7 kvramyasri7 left a comment

Choose a reason for hiding this comment

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

Niceeee!!!!!! 👏

@ashwinkumar6 ashwinkumar6 requested review from israx and ashika112 March 14, 2024 01:23
Copy link
Member

@ashika112 ashika112 left a comment

Choose a reason for hiding this comment

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

So much better. Thanks a ton 🚢

Copy link
Member

@israx israx left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for putting this together

Copy link
Member

@HuiSF HuiSF left a comment

Choose a reason for hiding this comment

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

🚀

@ashwinkumar6 ashwinkumar6 merged commit 5d4ccd6 into aws-amplify:main Mar 14, 2024
30 checks passed
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.

5 participants