27 lines
972 B
JavaScript
27 lines
972 B
JavaScript
import test from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { readFile } from 'node:fs/promises'
|
|
|
|
const root = new URL('../', import.meta.url)
|
|
|
|
async function text(path) {
|
|
return readFile(new URL(path, root), 'utf8')
|
|
}
|
|
|
|
test('dashboard primary surface is a device monitoring board, not an API catalog', async () => {
|
|
const html = await text('public/index.html')
|
|
const app = await text('public/app.js')
|
|
|
|
assert.match(html, /设备监控|设备详情|实时状态/)
|
|
assert.match(app, /renderDeviceDetails/)
|
|
assert.match(app, /温度/)
|
|
assert.match(app, /流量|速率/)
|
|
assert.match(app, /内存|磁盘/)
|
|
assert.match(app, /SIM|ICCID/)
|
|
assert.match(app, /短信/)
|
|
|
|
const dashboardBlock = html.match(/<section id="dashboardView"[\s\S]*?<\/section>\s*<section id="apiView"/)
|
|
assert.ok(dashboardBlock, 'dashboardView block should exist before apiView')
|
|
assert.doesNotMatch(dashboardBlock[0], /API 地图|endpointList|接口路径/)
|
|
})
|