fix(api+frontend): codex review 六件——死因空白strip/终态422防500/落盘回读断言/validator精确断言/promoted确认路径/文案不越权承诺 [vps]
This commit is contained in:
@@ -76,10 +76,10 @@ describe('FactorDetail.vue 危险区送墓园(2026-10-09 补丁)', () => {
|
||||
vi.mocked(api.postFactorVerdict).mockResolvedValue({ ok: true, action: 'graveyard' })
|
||||
const w = await mountDetail()
|
||||
await w.find('.grave-btn').trigger('click')
|
||||
// validator:空死因拒/非空过
|
||||
// validator:空死因拒(返回提示串)/非空过(严格 true)——codex review HIGH-3 断言精确化
|
||||
const validator = captured.inputValidator as (v: string) => string | boolean
|
||||
expect(validator('')).toBeTruthy()
|
||||
expect(validator(' ')).toBeTruthy()
|
||||
expect(validator('')).toBe('死因必填')
|
||||
expect(validator(' ')).toBe('死因必填')
|
||||
expect(validator('死因')).toBe(true)
|
||||
expect(api.postFactorVerdict).toHaveBeenCalledWith(
|
||||
'insider_buy_decay60', 'graveyard', [], '概念与既有因子重复')
|
||||
@@ -103,4 +103,18 @@ describe('FactorDetail.vue 危险区送墓园(2026-10-09 补丁)', () => {
|
||||
expect(api.postFactorVerdict).not.toHaveBeenCalled()
|
||||
confirmSpy.mockRestore()
|
||||
})
|
||||
it('promoted 重确认通过后继续送墓园(确认路径,decaying 同款文案)', async () => {
|
||||
// codex review MEDIUM-3:补确认继续路径+生产态危险区提示
|
||||
vi.spyOn(ElMessageBox, 'confirm').mockResolvedValue({} as never)
|
||||
vi.spyOn(ElMessageBox, 'prompt').mockResolvedValue({ value: '衰减不止' } as never)
|
||||
vi.mocked(api.postFactorVerdict).mockResolvedValue({ ok: true, action: 'graveyard' })
|
||||
const w = await mountDetail({
|
||||
factor: { ...DETAIL.factor, status: 'decaying' },
|
||||
birth: null,
|
||||
})
|
||||
expect(w.text()).toContain('生产因子判死需二次确认')
|
||||
await w.find('.grave-btn').trigger('click')
|
||||
expect(api.postFactorVerdict).toHaveBeenCalledWith(
|
||||
'insider_buy_decay60', 'graveyard', [], '衰减不止')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -56,7 +56,8 @@ async function sendToGraveyard(): Promise<void> {
|
||||
burying.value = true
|
||||
try {
|
||||
await postFactorVerdict(name.value, 'graveyard', [], note)
|
||||
ElMessage.success('已入墓园(卡片已回写)')
|
||||
// codex review LOW-2:回写失败后端会降级留附记,不在此承诺「已回写」
|
||||
ElMessage.success('已入墓园')
|
||||
router.push('/pipeline/factors')
|
||||
} catch (e) {
|
||||
ElMessage.error(`判死失败: ${e instanceof Error ? e.message : e}`)
|
||||
|
||||
Reference in New Issue
Block a user