fastify / fastify-jwt

JWT utils for Fastify
MIT License
514 stars 99 forks source link

fix: Async key provider and errors should be resolved internally -- dynamic JWTs in tests #338

Closed jmjf closed 1 month ago

jmjf commented 4 months ago

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

NikitaIT commented 4 months ago

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.