|
@@ -1,4 +1,5 @@
|
|
|
import assert from 'node:assert/strict'
|
|
import assert from 'node:assert/strict'
|
|
|
|
|
+import test from 'node:test'
|
|
|
import {
|
|
import {
|
|
|
buildMonitoringQuery,
|
|
buildMonitoringQuery,
|
|
|
buildTrendQuery,
|
|
buildTrendQuery,
|
|
@@ -56,6 +57,21 @@ const trendPoint = normalizeMonitoringRecord({
|
|
|
assert.equal(trendPoint.updateTime, '2026-09-01 12:30:00')
|
|
assert.equal(trendPoint.updateTime, '2026-09-01 12:30:00')
|
|
|
assert.equal(trendPoint.value, 25.5)
|
|
assert.equal(trendPoint.value, 25.5)
|
|
|
|
|
|
|
|
|
|
+test('unmeasured water devices keep their identity and show a neutral monitoring empty state', () => {
|
|
|
|
|
+ for (const [metric, sample] of [
|
|
|
|
|
+ ['flow', { equipmentId: 'flow-11', equipmentName: '测试流量计', instantFlow: null, monitorTime: null }],
|
|
|
|
|
+ ['pressure', { equipmentId: 'pressure-12', equipmentName: '测试压力计', pressureValue: null, monitorTime: null }],
|
|
|
|
|
+ ['power', { equipmentId: 'leak-13', equipmentName: '测试漏失监测01', power: null, monitorTime: null }]
|
|
|
|
|
+ ]) {
|
|
|
|
|
+ const row = normalizeMonitoringRecord(sample, metric)
|
|
|
|
|
+ assert.equal(row.id, sample.equipmentId)
|
|
|
|
|
+ assert.equal(row.equipmentName, sample.equipmentName)
|
|
|
|
|
+ assert.equal(row.value, null)
|
|
|
|
|
+ assert.equal(row.status, 'no-data')
|
|
|
|
|
+ assert.equal(row.updateTime, '-')
|
|
|
|
|
+ }
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
const exportError = await readMonitoringExportError(
|
|
const exportError = await readMonitoringExportError(
|
|
|
new Blob(['{"code":500,"msg":"导出数据过多"}'], {type: 'application/json'})
|
|
new Blob(['{"code":500,"msg":"导出数据过多"}'], {type: 'application/json'})
|
|
|
)
|
|
)
|