feat: 完善我的设备入口页
This commit is contained in:
30
scripts/tests/devices-page.test.cjs
Normal file
30
scripts/tests/devices-page.test.cjs
Normal file
@@ -0,0 +1,30 @@
|
||||
const assert = require("node:assert/strict");
|
||||
const { getDeviceCards } = require("../../tmp/devices-tests/device-data.js");
|
||||
|
||||
function run(name, fn) {
|
||||
try {
|
||||
fn();
|
||||
console.log(`PASS ${name}`);
|
||||
} catch (error) {
|
||||
console.error(`FAIL ${name}`);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
run("getDeviceCards returns the three expected device groups in order", () => {
|
||||
const cards = getDeviceCards();
|
||||
|
||||
assert.deepEqual(
|
||||
cards.map((item) => item.key),
|
||||
["vitals", "smart-bed", "ai-camera"]
|
||||
);
|
||||
});
|
||||
|
||||
run("getDeviceCards exposes display-ready status copy for each card", () => {
|
||||
const cards = getDeviceCards();
|
||||
|
||||
assert.deepEqual(
|
||||
cards.map((item) => item.statusText),
|
||||
["未绑定设备", "1 台设备在线", "权限待确认"]
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user