fix: jsdoc
This commit is contained in:
+26
-3
@@ -512,7 +512,7 @@ test('buildBddContract reports scenario candidates and uncovered evidence', () =
|
||||
}
|
||||
spec.prototypeGuide = {
|
||||
description: '使用者登入',
|
||||
checklist: ['登入失敗時顯示錯誤訊息', '連續錯誤三次鎖定帳號'],
|
||||
checklist: ['登入失敗時顯示錯誤訊息', '連續錯誤三次鎖定帳號', '支援外部 SSO 導向'],
|
||||
flowRefs: [{ title: '登入失敗流程', nodes: [{ nodeType: 'error', action: '顯示錯誤訊息' }] }]
|
||||
}
|
||||
spec.apiContract = {
|
||||
@@ -524,14 +524,37 @@ test('buildBddContract reports scenario candidates and uncovered evidence', () =
|
||||
const markdown = renderBddContract(spec, contract)
|
||||
|
||||
assert.ok(contract.candidateScenarios.some((candidate) => candidate.type === 'error-path'))
|
||||
assert.ok(contract.candidateScenarios.some((candidate) => candidate.source === 'prototypeGuide.checklist' && candidate.evidenceText === '登入失敗時顯示錯誤訊息'))
|
||||
assert.ok(contract.candidateScenarios.some((candidate) => candidate.source === 'api-error'))
|
||||
assert.ok(contract.uncoveredEvidence.some((item) => item.source === 'prototypeGuide.checklist' && item.text === '連續錯誤三次鎖定帳號'))
|
||||
assert.ok(contract.uncoveredEvidence.some((item) => item.source === 'prototypeGuide.checklist' && item.text === '支援外部 SSO 導向'))
|
||||
assert.ok(!contract.uncoveredEvidence.some((item) => item.text === '登入失敗時顯示錯誤訊息'))
|
||||
assert.ok(contract.uncoveredEvidence.some((item) => item.source === 'pageContract.actions' && item.text === '忘記密碼'))
|
||||
assert.equal(contract.requiresHumanReview, true)
|
||||
assert.match(markdown, /## Candidate Scenarios/)
|
||||
assert.match(markdown, /登入失敗時顯示錯誤訊息/)
|
||||
assert.match(markdown, /## Uncovered Evidence/)
|
||||
assert.match(markdown, /連續錯誤三次鎖定帳號/)
|
||||
assert.match(markdown, /支援外部 SSO 導向/)
|
||||
})
|
||||
|
||||
test('buildPageContract prefers meaningful rendered labels over fallback control names', () => {
|
||||
const contract = buildPageContract({
|
||||
page: 'dynamic-form.html',
|
||||
source: '/repo/prototype/dynamic-form.html',
|
||||
html: '<main><input id="email"></main>',
|
||||
regions: extractRegions('<main><input id="email"></main>'),
|
||||
domSummary: {
|
||||
title: null,
|
||||
headings: [],
|
||||
buttons: [],
|
||||
labels: ['Email'],
|
||||
inputs: [{ tag: 'input', type: 'text', name: 'email', label: 'Email', required: true }],
|
||||
textSamples: ['Email']
|
||||
},
|
||||
screenshotPath: null
|
||||
})
|
||||
|
||||
assert.equal(contract.forms[0].fields[0].label, 'Email')
|
||||
assert.equal(contract.forms[0].fields[0].required, true)
|
||||
})
|
||||
|
||||
function buildSpec(source, html) {
|
||||
|
||||
Reference in New Issue
Block a user