Skip to content
This repository was archived by the owner on Mar 30, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/plugin/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ describe("isOAuthAuth", () => {
};
expect(isOAuthAuth(auth)).toBe(false);
});

it("returns false for undefined auth without throwing", () => {
expect(isOAuthAuth(undefined)).toBe(false);
});

it("returns false for null auth without throwing", () => {
expect(isOAuthAuth(null)).toBe(false);
});
});

describe("parseRefreshParts", () => {
Expand Down
4 changes: 2 additions & 2 deletions src/plugin/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type { AuthDetails, OAuthAuthDetails, RefreshParts } from "./types";

const ACCESS_TOKEN_EXPIRY_BUFFER_MS = 60 * 1000;

export function isOAuthAuth(auth: AuthDetails): auth is OAuthAuthDetails {
return auth.type === "oauth";
export function isOAuthAuth(auth: AuthDetails | null | undefined): auth is OAuthAuthDetails {
return !!auth && auth.type === "oauth";
}

/**
Expand Down