31 lines
749 B
JavaScript
31 lines
749 B
JavaScript
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 台设备在线", "权限待确认"]
|
|
);
|
|
});
|