[PR #4597] [MERGED] test: improve coverage for jwt #5471

Closed
opened 2026-03-13 12:24:02 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4597
Author: @himself65
Created: 9/11/2025
Status: Merged
Merged: 9/12/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/09/11/jwks


📝 Commits (1)

  • 6149621 test: improve coverage for jwt

📊 Changes

1 file changed (+267 additions, -25 deletions)

View changed files

📝 packages/better-auth/src/plugins/jwt/jwt.test.ts (+267 -25)

📄 Description

Closes: https://github.com/better-auth/better-auth/issues/4488

Summary by cubic

Expanded tests for the JWT plugin’s JWKS remoteUrl config. Covers alg requirements, endpoint behavior, token/signing flows, and URL shapes.

  • Test Coverage
    • Require alg when using remoteUrl (throws "jwks_config"); accept when provided across ES256/ES512/RS256/PS256/EdDSA.
    • Disable /jwks (404) when remoteUrl is set; token and session endpoints still work.
    • Verify token generation (JWT format) and session returns set-auth-jwt header.
    • Respect custom jwt.sign even with remoteUrl (token includes mock-signature).
    • Cover remoteUrl variants (well-known, paths, ports, query params) and document current lack of URL format validation.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4597 **Author:** [@himself65](https://github.com/himself65) **Created:** 9/11/2025 **Status:** ✅ Merged **Merged:** 9/12/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/09/11/jwks` --- ### 📝 Commits (1) - [`6149621`](https://github.com/better-auth/better-auth/commit/6149621f8caa920947c6f7bc947dde1bcb92959f) test: improve coverage for jwt ### 📊 Changes **1 file changed** (+267 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/jwt/jwt.test.ts` (+267 -25) </details> ### 📄 Description Closes: https://github.com/better-auth/better-auth/issues/4488 <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Expanded tests for the JWT plugin’s JWKS remoteUrl config. Covers alg requirements, endpoint behavior, token/signing flows, and URL shapes. - **Test Coverage** - Require alg when using remoteUrl (throws "jwks_config"); accept when provided across ES256/ES512/RS256/PS256/EdDSA. - Disable /jwks (404) when remoteUrl is set; token and session endpoints still work. - Verify token generation (JWT format) and session returns set-auth-jwt header. - Respect custom jwt.sign even with remoteUrl (token includes mock-signature). - Cover remoteUrl variants (well-known, paths, ports, query params) and document current lack of URL format validation. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:24:02 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#5471