fix: Async key provider and errors should be resolved internally -- dynamic JWTs in tests
Generates JWTs dynamically in tests as requested by @mcollina on https://github.com/fastify/fastify-jwt/pull/335.
If there's a way to apply this change to the original PR, please point me toward it and I'll do it.
This PR includes the changes @NikitaFedorov1 made for PR 335. My understanding of his comment in 335 is that he does not intend to apply the test changes requested. I just changed a few lines in his tests (commit #5) so others can get the benefit of this fix.
I broke the tests several times before getting them right, so I know they can fail. :smile: Also confirmed response bodies/error details matched those from the hard coded tokens while working on the tests.
PR 335 description
False positive tests: test: Async key provider errors should be resolved internally
Fix & test fix: feat: Async key provider
Related issue: https://github.com/fastify/fastify-jwt/issues/334
Checklist
- [x] run
npm run testandnpm run benchmark - [x] tests and/or benchmarks are included
- [x] documentation is changed or added
- [x] commit message and code follows the Developer's Certification of Origin and the Code of conduct
Yes, I've been very busy lately and I completely forgot about it. It looks good. Thank you. Just hold this pr instead of mine.