Files

18 lines
1.2 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'use strict'
const assert = require('assert')
const fs = require('fs')
const path = require('path')
const source = fs.readFileSync(path.join(__dirname, '..', 'app.js'), 'utf8')
// P1 拆分批 3(2026-10-28):computeEdgePath 已迁到 src/canvas-geometry.js(改读新模块,不删断言)
const geometrySrc = fs.readFileSync(path.join(__dirname, '..', 'src', 'canvas-geometry.js'), 'utf8')
// 结构优化 step-1(2026-10-28):EdgePath 组件已迁到 src/ui-canvas-view.js(改读新模块,不删断言)
const uiCanvasSrc = fs.readFileSync(path.join(__dirname, '..', 'src', 'ui-canvas-view.js'), 'utf8')
// 借鉴参考项目:连线独立 memo 组件,拖动时只有相连边重算
assert.ok(geometrySrc.includes('function computeEdgePath(ed, graph, nodeMap, measuredH, pathCache)'))
assert.ok(uiCanvasSrc.includes('function EdgePath(props)'))
assert.ok(source.includes('const EdgePathMemo = React.memo(EdgePath'))
assert.ok(source.includes('el(EdgePathMemo, {'))
assert.ok(source.includes("const graphCache = refs.graphCache || (refs.graphCache = { nodes: null, edges: null, index: null })"))
assert.ok(source.includes('NodeCardMemo'))
console.log('canvas edge memo checks passed')