|
|
@@ -1,5 +1,7 @@
|
|
|
import test from 'node:test'
|
|
|
import assert from 'node:assert/strict'
|
|
|
+import fs from 'node:fs'
|
|
|
+import path from 'node:path'
|
|
|
|
|
|
import {
|
|
|
buildWaterFacilityQuery,
|
|
|
@@ -42,3 +44,14 @@ test('getRequestErrorMessage exposes a useful server error', () => {
|
|
|
assert.equal(getRequestErrorMessage(new Error('网络断开'), '查询失败'), '网络断开')
|
|
|
assert.equal(getRequestErrorMessage({}, '查询失败'), '查询失败')
|
|
|
})
|
|
|
+
|
|
|
+test('facility detail requests retain a retryable error state', () => {
|
|
|
+ const pages = ['pipeInfo', 'waterPlant', 'pumpStation', 'waterSource', 'waterUserInfo']
|
|
|
+ for (const page of pages) {
|
|
|
+ const file = path.resolve('src/views/subSystem/basic', page, 'index.vue')
|
|
|
+ const source = fs.readFileSync(file, 'utf8')
|
|
|
+ const detailMethod = source.match(/handleDetail\(row\)\s*\{([\s\S]*?)\n\s*\},/)
|
|
|
+ assert.ok(detailMethod, `${page} detail method should exist`)
|
|
|
+ assert.match(detailMethod[1], /\.catch\(error => \{[\s\S]*?this\.errorMessage = getRequestErrorMessage\(/, page)
|
|
|
+ }
|
|
|
+})
|