This commit is contained in:
2026-09-29 18:47:52 +08:00
parent 0aaf855ce2
commit b118189e4e
4 changed files with 18 additions and 11 deletions
+3 -3
View File
@@ -108,11 +108,11 @@ test('refresh replacement validates the unified token before atomically changing
assert.equal(session.refreshToken, 'refresh-43')
})
test('refresh cannot carry an old operation into another user or warehouse', () => {
test('refresh cannot carry an old operation into another user, membership, tenant or warehouse', () => {
storage(); signOut(); signInWithTokens(tokenPair())
const original = session.token
for (const domestic of [{ user_id: 99 }, { overseas_warehouse_id: 901 }]) {
assert.throws(() => replaceTokens(tokenPair({ domestic })), /主体或绑定仓库已变更/)
for (const domestic of [{ user_id: 99 }, { membership_id: 85 }, { tenant_id: 1 }, { overseas_warehouse_id: 901 }]) {
assert.throws(() => replaceTokens(tokenPair({ domestic })), /主体或绑定仓库已变更|不属于平台仓库作业端/)
assert.equal(session.token, original)
assert.equal(session.currentUser.warehouseId, '900')
}