Skip to content

Commit

Permalink
fix: isLoggedIn not returning correct boolean (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
JorWo authored Oct 30, 2024
1 parent 1f4ac66 commit 8262b5d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next-cas-client",
"version": "1.0.3",
"version": "1.1.1",
"description": "A CAS client built for Next.js to authenticate, validate tickets, and provide session management to a CAS server",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ export const getCurrentUser = async <T = CasUser>(): Promise<T | null> => {
*/
export const isLoggedIn = async (): Promise<boolean> => {
const { user } = await getSession();
return user !== null;
return user !== null && user !== undefined;
};
2 changes: 1 addition & 1 deletion test/lib/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Server', () => {
it('should return false', async () => {
jest.spyOn(IronSession, 'getIronSession').mockResolvedValue(createMockSession());

expect(await isLoggedIn()).toBeTruthy();
expect(await isLoggedIn()).toBeFalsy();
});
});
});

0 comments on commit 8262b5d

Please sign in to comment.