import test from 'node:test' import assert from 'node:assert/strict' import { readFile } from 'node:fs/promises' const homePath = 'src/views/subSystem/waterSupply/components/WaterSupplyHome.vue' test('home removes the A/B/C placeholder headings', async () => { const source = await readFile(homePath, 'utf8') assert.doesNotMatch(source, /A · 指挥台/u) assert.doesNotMatch(source, /B · 异常待办/u) assert.doesNotMatch(source, /C · 数据总览/u) }) test('home realtime alarms split between audit and work order by display status', async () => { const source = await readFile(homePath, 'utf8') assert.match(source, /openRealtimeAlarm\(item\)/u) assert.match(source, /realtimeAlarmJumpTarget\(item\)/u) assert.match(source, /goPage\(target\.path, target\.query\)/u) assert.match(source, /item\.displayStatusText/u) assert.match(source, /item\.displayStatusType/u) assert.match(source, /goPage\('\/device\/maintain'/u) }) test('home overview uses the shared GIS map canvas and aggregates all one-map layers', async () => { const source = await readFile(homePath, 'utf8') assert.match(source, / { const source = await readFile(homePath, 'utf8') assert.match(source, /grid-template-columns:\s*minmax\(240px,\s*1fr\)\s+minmax\(0,\s*3fr\)\s+minmax\(240px,\s*1fr\)/u) }) test('home work order jumps point to device maintenance dispatch page', async () => { const source = await readFile(homePath, 'utf8') const jumps = source.match(/goPage\('\/device\/maintain'/gu) || [] assert.ok(jumps.length >= 3, 'header, work order rows and related order should all route to device maintain') assert.doesNotMatch(source, /monitorAlarm\/workOrder/u) assert.match(source, />设备维修派单<\/el-button>/u) }) test('home B-road detail panel is 1:1 with the todo and shortcut panels', async () => { const source = await readFile(homePath, 'utf8') assert.match(source, /workbench-grid--equal/u) assert.match(source, /repeat\(3,\s*minmax\(0,\s*1fr\)\)/u) const sectionB = source.match(/
([\s\S]*?)/u) assert.ok(sectionB, 'detail panel should live in the equal-width B section') }) test('home list panels scroll to reveal the full queue instead of pinning a few rows', async () => { const source = await readFile(homePath, 'utf8') const listSelector = source.match(/\.compact-list\s*\{[^}]*\}/u) assert.ok(listSelector, 'compact list style block exists') assert.match(listSelector[0], /max-height:\s*[\w.]+/u) assert.match(listSelector[0], /overflow-y:\s*auto/u) assert.match(source, /listRealtimeAlarms\(\),/u) }) test('home overview map fills the full map card body', async () => { const source = await readFile(homePath, 'utf8') assert.match(source, /\.map-panel[\s\S]{0,160}?display:\s*flex/u) assert.match(source, /\.map-stage[\s\S]{0,140}?flex:\s*1/u) }) test('home overview legend and detail cover unified device and facility status colors', async () => { const source = await readFile(homePath, 'utf8') assert.match(source, /gisPointStatusColors\.alarm[\s\S]{0,20}报警\/异常/u) assert.match(source, /gisPointStatusColors\.workOrder[\s\S]{0,20}工单\/检修中/u) assert.match(source, /gisPointStatusColors\.warning[\s\S]{0,20}预警\/欠费/u) assert.match(source, /gisPointStatusColors\.offline[\s\S]{0,20}离线/u) assert.match(source, /gisPointStatusColors\.normal[\s\S]{0,20}正常/u) assert.match(source, /overviewDetail\.statusText \|\| gisStatusLabel\(overviewDetail\.statusKey\)/u) })