import { describe, expect, it } from 'vitest'; import { nextOutlookAutoLoadTarget } from '@/lib/outlook-page-state'; describe('nextOutlookAutoLoadTarget', () => { it('loads the active mailbox once when it has not been attempted', () => { expect( nextOutlookAutoLoadTarget({ isConfigured: true, activeView: 'inbox', loaded: { inbox: false, sent: false, calendar: false }, loading: { inbox: false, sent: false, calendar: false }, attempted: { inbox: false, sent: false, calendar: false }, }) ).toBe('inbox'); }); it('does not auto-retry the same mailbox after a failed attempt', () => { expect( nextOutlookAutoLoadTarget({ isConfigured: true, activeView: 'inbox', loaded: { inbox: false, sent: false, calendar: false }, loading: { inbox: false, sent: false, calendar: false }, attempted: { inbox: true, sent: false, calendar: false }, }) ).toBeNull(); }); });