import assert from "node:assert/strict";
import { readFileSync } from "node:fs";

const dashboardSource = readFileSync(new URL("../src/views/DashboardView.vue", import.meta.url), "utf8");

assert.match(dashboardSource, /原材料生命周期 DAG/, "经营总览应保留原材料生命周期 DAG");
assert.match(dashboardSource, /拖动画布 · 点击节点看详情/, "DAG 操作提示不应再提滚轮缩放");
assert.match(dashboardSource, /title="放大"[\s\S]*@click="zoomCanvasBy\(0\.08\)"/, "DAG 右上角应提供放大按钮");
assert.match(dashboardSource, /title="缩小"[\s\S]*@click="zoomCanvasBy\(-0\.08\)"/, "DAG 右上角应提供缩小按钮");
assert.match(dashboardSource, /function zoomCanvasBy\(delta\)/, "DAG 应通过按钮函数调整缩放比例");

assert.doesNotMatch(dashboardSource, /@wheel/, "DAG 视图不应绑定鼠标滚轮缩放");
assert.doesNotMatch(dashboardSource, /function zoomCanvas\(event\)/, "DAG 不应保留鼠标滚轮缩放函数");
assert.doesNotMatch(dashboardSource, /deltaY/, "DAG 缩放逻辑不应依赖鼠标滚轮 deltaY");

console.log("dashboard lifecycle DAG zoom checks passed");
