Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add auth tests #126

Merged
merged 17 commits into from
Dec 7, 2023
Merged

Add auth tests #126

merged 17 commits into from
Dec 7, 2023

Conversation

Timothy-Gonzalez
Copy link
Member

@Timothy-Gonzalez Timothy-Gonzalez commented Nov 16, 2023

Adds tests for every auth endpoint, and fixes a lot of stuff (blame: @AydanPirani, test your stuff!)

Resolves #108

  • auth-lib.ts
    • getJwtPayloadFromProfile
  • auth-router.ts
    • GET /auth/test/ was only used for testing
    • GET /auth/login/github/
    • GET /auth/login/google/
    • GET /auth/:PROVIDER/callback/:DEVICE/
    • GET /auth/roles/:USERID/
    • PUT /auth/roles/:OPERATION/
    • GET /auth/list/roles/ no current use, no practical use
    • GET /auth/roles/
    • GET /auth/roles/list/:ROLE/
    • GET /auth/token/refresh/

Coverage:

src/services/auth        |   93.47 |    79.16 |    87.5 |   93.47 |
  auth-lib.ts            |   88.95 |    68.88 |   86.66 |   88.95 | 26-27,38-40,73-74,91-92,103-107,117-118,123-124,145-146,151-152,172,219-220,258,268-269,271-272,292-293,305-306,324-325 
  auth-models.ts         |     100 |      100 |     100 |     100 |
  auth-router.ts         |   96.79 |    84.72 |     100 |   96.79 | 201-202,234-235,277-279,335-336,369-371

Most of what is not covered is error handling, which is really hard to mock. My upcoming error handling pr fix should solve this.

I am taking a break from jest testing after this.

Copy link
Collaborator

@AydanPirani AydanPirani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, feel free to merge!

src/services/auth/auth-lib.test.ts Outdated Show resolved Hide resolved
@Timothy-Gonzalez Timothy-Gonzalez merged commit d420c1c into main Dec 7, 2023
5 checks passed
@Timothy-Gonzalez Timothy-Gonzalez deleted the dev/timothy/auth-tests branch December 7, 2023 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tests for auth service
2 participants