refactor: enforce 800 line source limits

This commit is contained in:
caoxiaozhu
2026-06-22 11:58:53 +08:00
parent 08a4fa3577
commit 6d33ba5742
150 changed files with 27413 additions and 23791 deletions

View File

@@ -24,6 +24,14 @@ const overviewViewModel = readFileSync(
fileURLToPath(new URL('../src/composables/useOverviewView.js', import.meta.url)),
'utf8'
)
const overviewDisplayModel = readFileSync(
fileURLToPath(new URL('../src/composables/overviewViewDisplayModel.js', import.meta.url)),
'utf8'
)
const overviewRangeModel = readFileSync(
fileURLToPath(new URL('../src/composables/overviewViewRangeModel.js', import.meta.url)),
'utf8'
)
const overviewTemplate = readFileSync(
fileURLToPath(new URL('../src/views/OverviewView.vue', import.meta.url)),
'utf8'
@@ -110,7 +118,7 @@ test('risk dashboard localizes backend metric keys before rendering', () => {
)
assert.match(riskLabels, /travel:/)
assert.match(riskLabels, /rule_center:/)
assert.match(overviewViewModel, /formatRiskSignalLabel/)
assert.match(overviewDisplayModel, /formatRiskSignalLabel/)
assert.match(overviewViewModel, /riskCompositionLegend/)
assert.match(overviewViewModel, /signalDistribution/)
assert.doesNotMatch(overviewViewModel, /formatRiskSourceLabel/)
@@ -145,10 +153,10 @@ test('overview custom date defaults use current year instead of hard-coded legac
})
test('risk daily trend is bucketed for long ranges and keeps chart labels readable', () => {
assert.match(overviewViewModel, /RISK_DAILY_TREND_MAX_BUCKETS = 14/)
assert.match(overviewRangeModel, /RISK_DAILY_TREND_MAX_BUCKETS = 14/)
assert.match(overviewViewModel, /aggregateRiskDailyTrendRows/)
assert.match(overviewViewModel, /Math\.ceil\(normalizedRows\.length \/ maxBuckets\)/)
assert.match(overviewViewModel, /buildRiskTrendBucketLabel/)
assert.match(overviewRangeModel, /Math\.ceil\(normalizedRows\.length \/ maxBuckets\)/)
assert.match(overviewRangeModel, /buildRiskTrendBucketLabel/)
assert.doesNotMatch(overviewViewModel, /rows\.slice\(-7\)/)
assert.match(riskDailyTrendChart, /const barWidth = computed/)
assert.match(riskDailyTrendChart, /barMaxWidth: 14/)