import test from "node:test"; import assert from "node:assert/strict"; import { meltState } from "../src/views/Monitor/MeltState.js"; test("稳定温度下熔融与沉积指标处于演示基准", () => { const state = meltState({ nozzle: 220, vision: false }); assert.equal(state.width, 0.44); assert.equal(state.continuity, 99); assert.equal(state.alarm, false); }); test("温降与欠挤出减小料线宽度并降低连续性", () => { const cold = meltState({ nozzle: 192, vision: false }); const fault = meltState({ nozzle: 220, vision: true }); assert.ok(cold.width < 0.44 && cold.continuity < 99 && cold.alarm); assert.ok(fault.width < cold.width && fault.continuity < cold.continuity); }); test("过热增加铺展,恢复温度后状态复原", () => { const hot = meltState({ nozzle: 262, vision: false }); assert.ok(hot.width > 0.44 && hot.spread > 1 && hot.alarm); assert.equal(meltState({ nozzle: 220, vision: false }).alarm, false); });