Files
X-Financial/web/tests/risk-observation-evidence-card.test.mjs

43 lines
1.8 KiB
JavaScript
Raw Normal View History

import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
import { fileURLToPath } from 'node:url'
const component = readFileSync(
fileURLToPath(new URL('../src/components/travel/RiskObservationEvidenceCard.vue', import.meta.url)),
'utf8'
)
const styles = readFileSync(
fileURLToPath(
new URL('../src/assets/styles/components/risk-observation-evidence-card.css', import.meta.url)
),
'utf8'
)
test('risk observation evidence card supports switching active observation details', () => {
assert.match(component, /当前风险观察详情/)
assert.match(component, /const detailRegionId = 'risk-observation-active-detail'/)
assert.match(component, /:aria-controls="detailRegionId"/)
assert.match(component, /:aria-pressed="isActiveObservation\(item, index\)"/)
assert.match(component, /@click="selectObservation\(item, index\)"/)
assert.match(component, /const feedbackRows = computed/)
assert.match(component, /反馈历史/)
assert.match(styles, /\.risk-evidence-current-head/)
assert.match(styles, /\.risk-observation-row:focus-visible/)
})
test('risk observation evidence card remains scoped to current claim data', () => {
assert.match(component, /fetchClaimRiskObservations\(claimId\)/)
assert.doesNotMatch(component, /fetchEmployeeProfile/)
assert.doesNotMatch(component, /employeeBehaviorProfile/)
assert.doesNotMatch(component, /KnowledgeIngestGraphView/)
assert.doesNotMatch(component, /LightRAG/)
})
test('risk observation evidence card keeps empty observation state out of main flow', () => {
assert.match(component, /const visible = computed/)
assert.match(component, /observations\.value\.length > 0/)
assert.match(component, /暂无证据明细。/)
assert.match(component, /暂无人工反馈。/)
})