waterDeviceGisMap.test.mjs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import test from 'node:test'
  2. import assert from 'node:assert/strict'
  3. import { readFile } from 'node:fs/promises'
  4. test('device gis page is a dedicated map at the public route seam', async () => {
  5. const apiSource = await readFile('src/api/pipeNetwork/waterSupply.js', 'utf8')
  6. const entrySource = await readFile('src/views/subSystem/waterSupply/device/gis.vue', 'utf8')
  7. assert.match(apiSource, /export const getDeviceGisAllPoints = \(\) => get\('\/waterSupply\/device\/gis\/allPoints'\)/u)
  8. assert.match(apiSource, /export const getDeviceGisAbnormalPoints = \(\) => get\('\/waterSupply\/device\/gis\/abnormalPoints'\)/u)
  9. assert.match(apiSource, /export const getDeviceGisStatistics = \(\) => get\('\/waterSupply\/device\/gis\/statistics'\)/u)
  10. assert.match(apiSource, /export const getDeviceGisDetail = \(id\) => get\(`\/waterSupply\/device\/gis\/detail\/\$\{id\}`\)/u)
  11. assert.match(entrySource, /import WaterDeviceGisMap from '\.\.\/components\/WaterDeviceGisMap\.vue'/u)
  12. assert.doesNotMatch(entrySource, /WaterDevicePage/)
  13. })
  14. test('device gis map exposes water filtering, exception highlight and detail behavior', async () => {
  15. const source = await readFile(
  16. 'src/views/subSystem/waterSupply/components/WaterDeviceGisMap.vue',
  17. 'utf8'
  18. )
  19. assert.match(source, /getDeviceGisAllPoints/u)
  20. assert.match(source, /getDeviceGisAbnormalPoints/u)
  21. assert.match(source, /getDeviceGisStatistics/u)
  22. assert.match(source, /getDeviceGisDetail/u)
  23. assert.match(source, /equipmentTypeId/u)
  24. assert.match(source, /设备类型/u)
  25. assert.match(source, /searchKeyword/u)
  26. assert.match(source, /搜索设备/u)
  27. assert.match(source, /图例/u)
  28. assert.match(source, /报警/u)
  29. assert.match(source, /维修/u)
  30. assert.match(source, /离线/u)
  31. assert.match(source, /正常/u)
  32. assert.match(source, /BMapGL/u)
  33. assert.match(source, /el-drawer/u)
  34. assert.match(source, /设备详情/u)
  35. assert.match(source, /v-loading/u)
  36. assert.match(source, /暂无可显示的监测设备/u)
  37. assert.match(source, /重试/u)
  38. assert.match(source, /刷新/u)
  39. })
  40. test('device gis map separates status sources in detail text', async () => {
  41. const source = await readFile(
  42. 'src/views/subSystem/waterSupply/components/WaterDeviceGisMap.vue',
  43. 'utf8'
  44. )
  45. assert.match(source, /设备状态/u)
  46. assert.match(source, /在线状态/u)
  47. assert.match(source, /报警状态/u)
  48. assert.match(source, /报警等级/u)
  49. assert.match(source, /异常原因/u)
  50. assert.match(source, /最新数据/u)
  51. assert.match(source, /维修记录/u)
  52. })