Skip to content

test: add unit tests for getSessionWithToken utility - #3134

Open
saksham242007 wants to merge 3 commits into
Priyanshu-byte-coder:mainfrom
saksham242007:test-get-session-token
Open

saksham242007 wants to merge 3 commits into
Priyanshu-byte-coder:mainfrom
saksham242007:test-get-session-token

Conversation

@saksham242007

Copy link
Copy Markdown

Closes #3100

Adds unit tests for getSessionWithToken in src/lib/get-session-token.ts, mocking next-auth's getServerSession and @/lib/resolve-user. Covers null-session, missing-field, and success cases including verifying accessToken is correctly populated.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature type:testing GSSoC type bonus: tests (+10 pts) labels Jul 4, 2026
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@github-actions github-actions Bot added type:bug GSSoC type bonus: bug fix type:design GSSoC type bonus: UI/design (+10 pts) type:performance GSSoC type bonus: performance (+15 pts) labels Jul 6, 2026
@Priyanshu-byte-coder

Copy link
Copy Markdown
Owner

The getSessionWithToken test itself is good — imports the real module and mocks deps cleanly. But this PR is scoped as a test PR yet also adds a new ScrollToTopButton component wired into the dashboard, plus an unrelated blank line in middleware.ts. Please drop those two so this stays a focused test PR (the scroll-to-top UI can go in its own PR). Once it's just the test + session?.user guard, happy to merge.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

This PR has been inactive for 21 days. If it is still in progress, please leave an update — otherwise it will be closed in 7 days.

@github-actions github-actions Bot added the stale Inactive for 21+ days label Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution stale Inactive for 21+ days type:bug GSSoC type bonus: bug fix type:design GSSoC type bonus: UI/design (+10 pts) type:feature GSSoC type bonus: new feature type:performance GSSoC type bonus: performance (+15 pts) type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test : add tests for getSessionWithToken utility

2 participants