@@ -2201,6 +2201,33 @@ describe("OpenAIOAuthPlugin fetch handler", () => {
22012201 expect ( storageModule . loadAccounts ) . not . toHaveBeenCalled ( ) ;
22022202 } ) ;
22032203
2204+ it ( "does not add storage reads during loader init when footer counts are enabled" , async ( ) => {
2205+ const storageModule = await import ( "../lib/storage.js" ) ;
2206+ const getAuth = async ( ) => ( {
2207+ type : "oauth" as const ,
2208+ access : "access-token" ,
2209+ refresh : "refresh-token" ,
2210+ expires : Date . now ( ) + 60_000 ,
2211+ multiAccount : true ,
2212+ } ) ;
2213+ const runLoaderAndCountStorageReads = async ( ) : Promise < number > => {
2214+ const mockClient = createMockClient ( ) ;
2215+ const { OpenAIOAuthPlugin } = await import ( "../index.js" ) ;
2216+ const plugin = await OpenAIOAuthPlugin ( { client : mockClient } as never ) as unknown as PluginType ;
2217+ vi . mocked ( storageModule . loadAccounts ) . mockClear ( ) ;
2218+ await plugin . auth . loader ( getAuth , { options : { } , models : { } } ) ;
2219+ return vi . mocked ( storageModule . loadAccounts ) . mock . calls . length ;
2220+ } ;
2221+
2222+ await disablePersistedFooter ( ) ;
2223+ const baselineReadCount = await runLoaderAndCountStorageReads ( ) ;
2224+
2225+ await enablePersistedFooter ( "full-email" ) ;
2226+ const footerReadCount = await runLoaderAndCountStorageReads ( ) ;
2227+
2228+ expect ( footerReadCount ) . toBe ( baselineReadCount ) ;
2229+ } ) ;
2230+
22042231 it ( "uses the live account count when the cached footer hint is stale" , async ( ) => {
22052232 await enablePersistedFooter ( "full-email" ) ;
22062233 mockStorage . accounts = [
0 commit comments