Skip to content

Add unit tests for JWT token generation and verification utility #458

Description

@Cjay-Cyber-2

Description — what to implement and the why/impact.

Authentication relies heavily on JWT issuance and verification, particularly for SEP-10 sessions. Adding thorough unit tests for the JWT helper functions ensures token expiration, signature verification, and payload extraction work reliably.

Context & Requirements — background, constraints, design references, edge cases;

  • Grounded in src/utils/ or src/services/ where JWT operations reside.
  • Must test successful token creation, correct signature validation, and handling of expired or tampered tokens.

Acceptance Criteria — a checklist ("- [ ] ...") of specific, testable conditions that define "done".

  • Create test file for JWT utilities.
  • Test signing, verifying valid tokens, and rejecting invalid or expired tokens.
  • Ensure all tests pass via Vitest.

Implementation Guidance — likely files/modules to touch

  • Likely files: src/utils/jwt.test.ts or similar test file adjacent to JWT utility modules.
  • Suggested approach: Utilize jsonwebtoken library and Vitest assertions.

Testing & Validation — how the contributor should prove it works

  • Run npm test to verify the new test suite executes and passes.

Submission Guidelines — must open a PR that includes "Closes #"; assignment is required before starting.


Wave complexity: Trivial

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions