feat: update session management functions and improve partition handling
Desktop Client Build / Resolve Build Metadata (push) Successful in 31s
Frontend CI / Frontend (push) Successful in 2m58s
Backend CI / Backend (push) Successful in 18m2s
Desktop Client Build / Build Desktop Client (push) Successful in 24m49s
Desktop Client Build / Publish Client Artifacts to NAS (push) Successful in 38s
Desktop Client Build / Resolve Build Metadata (push) Successful in 31s
Frontend CI / Frontend (push) Successful in 2m58s
Backend CI / Backend (push) Successful in 18m2s
Desktop Client Build / Build Desktop Client (push) Successful in 24m49s
Desktop Client Build / Publish Client Artifacts to NAS (push) Successful in 38s
This commit is contained in:
@@ -9,8 +9,8 @@ const probeAIAccountSession = vi.fn()
|
||||
const probePublishAccountSession = vi.fn()
|
||||
const silentRefreshAIAccountSession = vi.fn()
|
||||
const silentRefreshPublishAccountSession = vi.fn()
|
||||
const getSessionHandle = vi.fn()
|
||||
const getPersistedPartition = vi.fn()
|
||||
const createSessionHandleForPartition = vi.fn()
|
||||
const resolveStoredSessionPartition = vi.fn()
|
||||
const emitRuntimeInvalidated = vi.fn()
|
||||
|
||||
vi.mock('electron/main', () => ({
|
||||
@@ -27,8 +27,8 @@ vi.mock('./account-binder', () => ({
|
||||
}))
|
||||
|
||||
vi.mock('./session-registry', () => ({
|
||||
getSessionHandle,
|
||||
getPersistedPartition,
|
||||
createSessionHandleForPartition,
|
||||
resolveStoredSessionPartition,
|
||||
}))
|
||||
|
||||
vi.mock('./runtime-events', () => ({
|
||||
@@ -68,8 +68,8 @@ describe('account health challenge recheck', () => {
|
||||
beforeEach(() => {
|
||||
vi.resetModules()
|
||||
vi.clearAllMocks()
|
||||
getSessionHandle.mockReturnValue({ partition: 'persist:test' })
|
||||
getPersistedPartition.mockReturnValue('persist:test')
|
||||
resolveStoredSessionPartition.mockReturnValue('persist:test')
|
||||
createSessionHandleForPartition.mockReturnValue({ partition: 'persist:test' })
|
||||
silentRefreshAIAccountSession.mockResolvedValue(true)
|
||||
silentRefreshPublishAccountSession.mockResolvedValue(true)
|
||||
})
|
||||
@@ -105,4 +105,23 @@ describe('account health challenge recheck', () => {
|
||||
expect(snapshot.authState).toBe('challenge_required')
|
||||
expect(snapshot.authReason).toBe('risk_control')
|
||||
})
|
||||
|
||||
it('probes restored default partitions instead of marking restarted accounts expired', async () => {
|
||||
resolveStoredSessionPartition.mockReturnValue('persist:acc-account-1')
|
||||
probeAIAccountSession.mockResolvedValueOnce(active())
|
||||
const { probeTrackedAccount } = await import('./account-health')
|
||||
|
||||
const snapshot = await probeTrackedAccount(account, {
|
||||
trigger: 'manual',
|
||||
allowSilentRefresh: true,
|
||||
force: true,
|
||||
})
|
||||
|
||||
expect(createSessionHandleForPartition).toHaveBeenCalledWith(
|
||||
'account-1',
|
||||
'persist:acc-account-1',
|
||||
)
|
||||
expect(probeAIAccountSession).toHaveBeenCalledWith(account, 'persist:acc-account-1')
|
||||
expect(snapshot.authState).toBe('active')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user