| 1234567891011121314151617181920212223242526 |
- import assert from 'node:assert/strict'
- import { readFile } from 'node:fs/promises'
- import test from 'node:test'
- import { orderStatusType, orderStatusText } from '../src/views/subSystem/pipeNetwork/ops/workOrder/workOrderDict.js'
- test('shared work-order dictionary covers the authoritative 0-7 status codes', () => {
- assert.deepEqual(
- [0, 1, 2, 3, 4, 5, 6, 7].map(orderStatusText),
- ['待派单', '待接单', '已接单', '处理中', '待验收', '已结案', '延期中', '已取消']
- )
- const types = [0, 1, 2, 3, 4, 5, 6, 7].map(orderStatusType)
- assert.ok(types.every(type => ['danger', 'warning', 'primary', 'success', 'info'].includes(type)))
- assert.equal(orderStatusType(5), 'success')
- assert.equal(orderStatusType(7), 'info')
- })
- test('water supply device pages reuse the shared dictionary instead of a private status table', async () => {
- const source = await readFile('src/views/subSystem/waterSupply/components/WaterDevicePage.vue', 'utf8')
- assert.doesNotMatch(source, /function\s+workOrderStatusType/, '页面不应自带工单状态色表')
- assert.match(
- source,
- /from '@\/views\/subSystem\/pipeNetwork\/ops\/workOrder\/workOrderDict\.js'/u,
- '页面应复用统一工单字典'
- )
- })
|