fix(pda): revoke expired sessions before completing logout

This commit is contained in:
2026-10-05 13:41:34 +08:00
parent 7aebbd2a70
commit e699e9d9ba
8 changed files with 192 additions and 18 deletions
+8 -5
View File
@@ -57,11 +57,14 @@ test('confirmed session expiry clears sensitive state and redirects only once',
assert.match(http, /if \(isUnauthorized\(error\)\) return expireSession/)
})
test('manual logout revokes the refresh token without delaying local cleanup', async () => {
const [profile, auth] = await Promise.all([read('../pages/profile/profile.vue'), read('../api/auth.js')])
assert.match(auth, /export function logout\(refreshToken, accessToken\)/)
assert.match(profile, /const refreshToken = session\.refreshToken[\s\S]*?const accessToken = session\.token[\s\S]*?signOut\(\)[\s\S]*?uni\.reLaunch/)
assert.match(profile, /logoutRequest\(refreshToken, accessToken\)\.catch/)
test('manual logout waits for captured-session revoke and honestly handles failure', async () => {
const [profile, helper] = await Promise.all([read('../pages/profile/profile.vue'), read('../api/logout-session.js')])
assert.match(profile, /logoutCurrentSession\(\)/)
assert.match(profile, /operation\.then/)
assert.match(profile, /服务端退出未确认/)
assert.match(helper, /signOut\(\)/)
assert.match(helper, /error\.statusCode !== 401/)
assert.doesNotMatch(profile, /catch\(\(\) => \{\}\)/)
})
test('production login starts empty and remembers only the account preference', async () => {