refactor: migrate to RemoteOAuthStorage for web OAuth handling

This commit is contained in:
Bob Dickinson 2026-07-03 13:11:13 -07:00
commit 7bd26c938e

View file

@ -1,5 +1,8 @@
import { describe, it, expect, beforeEach, afterEach } from "vitest";
import { BrowserOAuthStorage } from "@inspector/core/auth/browser/storage.js";
import {
BrowserOAuthStorage,
getBrowserOAuthStorage,
} from "@inspector/core/auth/browser/storage.js";
import type {
OAuthClientInformation,
OAuthTokens,
@ -41,6 +44,14 @@ const mockSessionStorage = new MockSessionStorage();
(global as typeof globalThis & { sessionStorage?: Storage }).sessionStorage =
mockSessionStorage;
describe("getBrowserOAuthStorage", () => {
it("returns the same singleton on repeated calls", () => {
const first = getBrowserOAuthStorage();
const second = getBrowserOAuthStorage();
expect(second).toBe(first);
});
});
describe("BrowserOAuthStorage", () => {
let storage: BrowserOAuthStorage;
const testServerUrl = "http://localhost:3000";