waterSupplyHomeContract.test.mjs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import test from 'node:test'
  2. import assert from 'node:assert/strict'
  3. import { readFile } from 'node:fs/promises'
  4. const homePath = 'src/views/subSystem/waterSupply/components/WaterSupplyHome.vue'
  5. test('home removes the A/B/C placeholder headings', async () => {
  6. const source = await readFile(homePath, 'utf8')
  7. assert.doesNotMatch(source, /A · 指挥台/u)
  8. assert.doesNotMatch(source, /B · 异常待办/u)
  9. assert.doesNotMatch(source, /C · 数据总览/u)
  10. })
  11. test('home realtime alarms split between audit and work order by display status', async () => {
  12. const source = await readFile(homePath, 'utf8')
  13. assert.match(source, /openRealtimeAlarm\(item\)/u)
  14. assert.match(source, /realtimeAlarmJumpTarget\(item\)/u)
  15. assert.match(source, /goPage\(target\.path, target\.query\)/u)
  16. assert.match(source, /item\.displayStatusText/u)
  17. assert.match(source, /item\.displayStatusType/u)
  18. assert.match(source, /goPage\('\/device\/maintain'/u)
  19. })
  20. test('home overview uses the shared GIS map canvas and aggregates all one-map layers', async () => {
  21. const source = await readFile(homePath, 'utf8')
  22. assert.match(source, /<GisMapCanvas/u)
  23. assert.match(source, /ref="overviewMapRef"/u)
  24. assert.match(source, /:points="overviewMapPoints"/u)
  25. assert.match(source, /:lines="overviewMapLines"/u)
  26. assert.match(source, /@point-click="openOverviewPoint"/u)
  27. assert.match(source, /@line-click="openOverviewPoint"/u)
  28. assert.match(source, /buildHomeGisOverview/u)
  29. assert.match(source, /getWaterFacilityFeatures\(\)/u)
  30. assert.match(source, /listAlarmMapPoints\(\)/u)
  31. assert.match(source, /getDeviceGisAllPoints\(\)/u)
  32. })
  33. test('home overview map takes at least 60% of the same row in desktop layout', async () => {
  34. const source = await readFile(homePath, 'utf8')
  35. assert.match(source, /grid-template-columns:\s*minmax\(240px,\s*1fr\)\s+minmax\(0,\s*3fr\)\s+minmax\(240px,\s*1fr\)/u)
  36. })
  37. test('home work order jumps point to device maintenance dispatch page', async () => {
  38. const source = await readFile(homePath, 'utf8')
  39. const jumps = source.match(/goPage\('\/device\/maintain'/gu) || []
  40. assert.ok(jumps.length >= 3, 'header, work order rows and related order should all route to device maintain')
  41. assert.doesNotMatch(source, /monitorAlarm\/workOrder/u)
  42. assert.match(source, />设备维修派单<\/el-button>/u)
  43. })