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.
Hello @Priyanshu-byte-coder, please assign this issue to me (@tmdeveloper007) so I can open a focused PR.
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.
Hello @Priyanshu-byte-coder, please assign this issue to me (@tmdeveloper007) so I can open a focused PR.