fix(cr2-frontend): 代理归属回退、换号继承确认与请求竞态收口
- CR-04:全局代理加 proxy_uid 归属,跨账号不再静默回退/补报 - CR-12:取消静默继承,设置页显式确认;同 OS 作用域、locked 代理排除、无效快照清除、uid+epoch 双校验、登出 capture 超时 - CR-26/27:关键词分页初始值与档位一致;两页面请求序号闸丢弃旧响应 vue-tsc 两前端 rc=0;定向 35 + 8 + 2 例全绿。
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { createLatestRequestGate } from '../src/utils/latest-request.ts'
|
||||
|
||||
test('latest_request_gate_only_accepts_the_newest_token', () => {
|
||||
const gate = createLatestRequestGate()
|
||||
const first = gate.begin()
|
||||
assert.equal(gate.isCurrent(first), true)
|
||||
|
||||
const second = gate.begin()
|
||||
assert.equal(gate.isCurrent(second), true)
|
||||
assert.equal(gate.isCurrent(first), false, '新请求一发出,旧 token 必须立即失效')
|
||||
})
|
||||
|
||||
test('latest_request_gate_starts_with_no_current_token', () => {
|
||||
const gate = createLatestRequestGate()
|
||||
assert.equal(gate.isCurrent(0), false, '未发请求前不能用 0 号 token 回写')
|
||||
const token = gate.begin()
|
||||
assert.ok(token > 0)
|
||||
assert.equal(gate.isCurrent(token), true)
|
||||
})
|
||||
Reference in New Issue
Block a user