elysiajs / elysia-jwt

Plugin for Elysia for using JWT Authentication
MIT License
38 stars 16 forks source link

Fix tests #37

Open silverlyra opened 3 months ago

silverlyra commented 3 months ago

The index.test.ts file appears to test this package, but it does not currently call jwt.sign or jwt.verify! The test app is never used, and assertions are being run on the test Requests, not any Responses returned from the test app.

This adds the missing await app.handle(…) calls, and fixes other issues in the app and test definitions.

I also included a new case – an otherwise-valid JWT generated with a different secret, to make sure that fails verification.

test/index.test.ts:
✓ JWT Plugin > signs and verifies JWTs [9.33ms]

 1 pass
 0 fail
 3 expect() calls