You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test : add tests for getSessionWithToken utility #3100
Summary of What Needs to be Done: Add unit tests for the session-with-token utility in src/lib/get-session-token.ts, covering getSessionWithToken return shape and null cases.
Changes that Need to be Made: Create test/get-session-token.test.ts with vitest mocking next-auth and @/lib/resolve-user. Cover: getSessionWithToken returns null when no session, returns null when session lacks githubId or githubLogin, returns null when session lacks accessToken, returns null when resolveAppUser returns null, returns SessionWithToken with correct shape when all conditions met, accessToken field is populated from session.
Impact that it would Provide: getSessionWithToken is used across authenticated API routes to get GitHub access tokens. Tests ensure the null-safety logic is correct and no null access errors occur when user data is incomplete.
Hi @Priyanshu-byte-coder, I'd like to work on this issue. I can add the unit tests for getSessionWithToken, covering the null cases and the valid session flow using mocks where needed. Please assign this issue to me. Thanks!
Activity
saksham242007 commentedon Jul 3, 2026
Hi @Priyanshu-byte-coder, I'd like to work on this issue. I can add the unit tests for getSessionWithToken, covering the null cases and the valid session flow using mocks where needed. Please assign this issue to me. Thanks!
github-actions commentedon Jul 3, 2026
Assigned to @saksham242007! You have 7 days to open a PR. No PR after 7 days = auto-unassigned so others can pick it up. Good luck!