waterAlarmManagement.test.mjs 1.4 KB

123456789101112131415161718192021222324252627
  1. import assert from 'node:assert/strict'
  2. import { readFile } from 'node:fs/promises'
  3. import test from 'node:test'
  4. test('the water alarm management menu resolves to the shared alarm list (scoped by query.rootTypeId)', async () => {
  5. const { resolveAlarmMenuView } = await import('../src/router/alarmMenuView.js')
  6. assert.equal(resolveAlarmMenuView('subSystem/alarm/common/list', '{"rootTypeId":1}'), 'subSystem/alarm/common/list')
  7. assert.equal(resolveAlarmMenuView('subSystem/alarm/common/list', '{"rootTypeId":2}'), 'subSystem/alarm/common/list')
  8. })
  9. test('water alarm detail offers audit and related work-order shortcuts without changing other systems', async () => {
  10. const detail = await readFile('src/views/subSystem/alarm/AlarmDetail.vue', 'utf8')
  11. assert.match(detail, /waterShortcuts/u)
  12. assert.match(detail, /goWaterWorkOrder/u)
  13. assert.match(detail, /navigate\('alarmAudit'/u)
  14. })
  15. test('water menu resolver is wired into dynamic route loading', async () => {
  16. const source = await readFile('src/store/modules/permission.js', 'utf8')
  17. assert.match(source, /loadView\(resolveAlarmMenuView\(route.component, route.query\)\)/u)
  18. })
  19. test('misreport remains distinct and the detail shortcut targets a searchable work order', async () => {
  20. const detail = await readFile('src/views/subSystem/alarm/AlarmDetail.vue', 'utf8')
  21. assert.match(detail, /keyword: alarm.value.orderNo/u)
  22. assert.ok(detail.includes('min(680px, 100vw)'))
  23. })