fix(pl): 区分用证详情权限失败与网络异常以保留完整账目保护。
This commit is contained in:
1 parent
fb45466c0c
commit
6eba9c1aae
2 files changed
+36
-5
No files matched your search
@@ -350,3 +350,28 @@ test('plan expansion loads on demand, preserves total during refresh and ignores
|
||||
assert.deepEqual(Object.keys(s.details), [])
|
||||
h.stop()
|
||||
})
|
||||
|
||||
for (const status of [403, 404, 500, undefined])
|
||||
test(`plan expansion reports ${status || 'network'} failure without showing partial usage`, async () => {
|
||||
const h = pageHarness('quota', { mobile: false }),
|
||||
s = h.state
|
||||
const pending = s.loadDetail('plan')
|
||||
h.gets[0].reject(status ? { response: { status } } : new Error('network'))
|
||||
await pending
|
||||
assert.equal(
|
||||
s.details.plan.error,
|
||||
[403, 404].includes(status as number)
|
||||
? '计划或证件不可读取,无法展示完整用证详情'
|
||||
: '段次用证加载失败,请重试'
|
||||
)
|
||||
assert.equal(s.details.plan.data, undefined)
|
||||
assert.equal(s.details.plan.loading, false)
|
||||
if (status === 500) {
|
||||
const retry = s.loadDetail('plan')
|
||||
h.gets[1].resolve({ planId: 'plan', sourceOptions: [], usages: [] })
|
||||
await retry
|
||||
assert.equal(s.details.plan.error, undefined)
|
||||
assert.equal(s.details.plan.data.planId, 'plan')
|
||||
}
|
||||
h.stop()
|
||||
})
|
||||
Reference in new issue
Block a user