| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- 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, /<GisMapCanvas/u)
- assert.match(source, /ref="overviewMapRef"/u)
- assert.match(source, /:points="overviewMapPoints"/u)
- assert.match(source, /:lines="overviewMapLines"/u)
- assert.match(source, /@point-click="openOverviewPoint"/u)
- assert.match(source, /@line-click="openOverviewPoint"/u)
- assert.match(source, /buildHomeGisOverview/u)
- assert.match(source, /getWaterFacilityFeatures\(\)/u)
- assert.match(source, /listAlarmMapPoints\(\)/u)
- assert.match(source, /getDeviceGisAllPoints\(\)/u)
- })
- test('home overview map takes at least 60% of the same row in desktop layout', async () => {
- 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)
- })
|