'use strict' const assert = require('assert') const fs = require('fs') const path = require('path') const source = fs.readFileSync(path.join(__dirname, '..', 'app.js'), 'utf8') // 结构优化 step-6(2026-10-28):BackupModal 已迁到 src/ui-backup-modal.js,断言读 app.js + 该模块。 const backupSrc = fs.readFileSync(path.join(__dirname, '..', 'src', 'ui-backup-modal.js'), 'utf8') // 2026-11-06:exportCanvas 已迁到 src/runtime-workbench-logic.js,断言一并读该模块。 const wbLogicSrc = fs.readFileSync(path.join(__dirname, '..', 'src', 'runtime-workbench-logic.js'), 'utf8') const sourceAll = source + '\n' + backupSrc + '\n' + wbLogicSrc assert.ok(sourceAll.includes('function withoutGenerationResults(value)')) assert.ok(sourceAll.includes("n.type === 'gen' && n.data && n.data.result !== undefined")) // 2026-11-03:画布保存不再「剥离」生成结果,改为精简后落盘(否则刷新/多标签/跨设备掉图); // 「剥离」只剩导出/备份路径在用(导出不该带会失效的结果链接)。 // 只钉这一条接线(钉点总数受 MAX_DIR_SOURCE_PINS 约束);合并/上云精简由 e2e 行为断言覆盖。 assert.ok(sourceAll.includes('GenerationResults.slimWs(ws)')) assert.ok(sourceAll.includes('workspaces: withoutGenerationResults((r && r.workspaces) || [])')) assert.ok(sourceAll.includes('const nodesForExport = await wResolveImagesForExport(withoutGenerationResults({ nodes: refs.nodes }).nodes)')) assert.ok(sourceAll.includes('const nodesForExport = await wResolveImagesForExport(withoutGenerationResults({ nodes: selectedNodes }).nodes)')) assert.ok(sourceAll.includes('async function wResolveImagesForExport(nodes)')) assert.ok(!source.includes("for (const f of oidx) if (f && f.idb) list.push")) console.log('persistence and export image stripping checks passed')