- 횡단 다시 셈이 화면이 쥔 선(측점 한 벌 · 관 지점 · 옮긴 꼭짓점)을 받음 — 종단도가 선을 맡기고 B06 진입 정합 · 3D [업데이트] 앞 다시 셈도 같은 선 · 낡음 판정도 그 선 기준(staleAgainstScreen) - 다시 셈 뒤에도 낡은 측점이 남으면 유토곡선은 그리고 그 측점만 표시 · 콘솔 경고 한 줄 · 흙 배분도 건너뛰지 않음(09-03 「새 값만 보여주기」 바꿈 · 사용자 확정 10-16) - 흙 배분: 실패한 열쇠 다시 보냄 · 받은 열쇠(누가토량 결과 전체)는 다시 안 물음 · 서버도 같은 열쇠 기억 · 묶음 실패는 500 - 옛 시험 셋 새 동작으로 맞춤 · 서버 열쇠 시험 더함 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QfHKQs7J3hQELKMWQMUJEy
83 lines
2.9 KiB
JavaScript
83 lines
2.9 KiB
JavaScript
/* PLAN 317-1 단위검증 헬퍼 — 낡음 지문(`staleKey`) · 같은 지문이면 다시 셈 안 함(`scheduleIfStale`).
|
|
* 화면 TS 를 그 자리에서 트랜스파일해 Node 로 돌림 · 다시 셈 창구는 흉내(부른 횟수만 셈).
|
|
* 짝 = `test_317_3d_update.py`.
|
|
*/
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
|
|
const CATALOG = require("./helper_322_catalog_module.cjs"); // 구조물 표(322-1)
|
|
|
|
const ROOT = path.join(__dirname, "..", "..");
|
|
let refreshCalls = 0;
|
|
const STUBS = {
|
|
"../B06_Section/B06_Section_Cross_Refresh": {
|
|
refreshCrossDesigns: async () => {
|
|
refreshCalls += 1;
|
|
return [];
|
|
},
|
|
holdScreenAlignment: () => () => {}, // 화면 선 맡김(342-1) — 이 시험 몫 아님
|
|
},
|
|
};
|
|
globalThis.window = { setTimeout: (fn) => (fn(), 1), clearTimeout: () => {} };
|
|
const cache = new Map();
|
|
const load = (file) => {
|
|
if (cache.has(file)) return cache.get(file);
|
|
const js = ts.transpileModule(fs.readFileSync(file, "utf8"), {
|
|
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
|
|
}).outputText;
|
|
const box = { exports: {} };
|
|
cache.set(file, box.exports);
|
|
const near = (m) => {
|
|
if (CATALOG.isCatalogRequest(m)) return CATALOG;
|
|
if (STUBS[m]) return STUBS[m];
|
|
if (m.startsWith("@util/")) return load(path.join(ROOT, "common_util", `${m.slice(6)}.ts`));
|
|
if (m.startsWith(".")) return load(path.join(path.dirname(file), `${m}.ts`));
|
|
return new Proxy({}, { get: () => () => {} });
|
|
};
|
|
new Function("exports", "module", "require", js)(box.exports, box, near);
|
|
return box.exports;
|
|
};
|
|
|
|
const { staleKey } = load(path.join(ROOT, "B06_Section", "B06_Section_UI_Section_Common.ts"));
|
|
const { createCrossPreview } = load(
|
|
path.join(ROOT, "B05_Profile", "B05_Profile_UI_Profile_Preview.ts"),
|
|
);
|
|
|
|
const detailOf = (sections) => ({
|
|
longitudinal: { design_profiles: [] },
|
|
cross_sections: sections,
|
|
});
|
|
const fordStale = {
|
|
chainage_m: 50,
|
|
ford_pavement: {},
|
|
design: { design_elevation_m: 1, paved: true },
|
|
};
|
|
const fordFresh = { ...fordStale, design: { ...fordStale.design, tilted: true } };
|
|
|
|
(async () => {
|
|
const out = {
|
|
key_stale: staleKey(detailOf([fordStale])),
|
|
key_fresh: staleKey(detailOf([fordFresh])),
|
|
};
|
|
const preview = createCrossPreview({
|
|
projectId: "p1",
|
|
detail: () => detailOf([fordStale]),
|
|
routeId: () => 1,
|
|
edits: () => ({ station_offsets: {}, curve_radii: {} }),
|
|
alignment: () => null,
|
|
debounceMs: () => 0,
|
|
onApplied: () => {},
|
|
});
|
|
const calls = [];
|
|
for (const key of ["a", "a", "", "a", "b"]) {
|
|
preview.scheduleIfStale(key);
|
|
await Promise.resolve();
|
|
calls.push(refreshCalls);
|
|
}
|
|
out.calls = calls;
|
|
process.stdout.write(JSON.stringify(out));
|
|
})().catch((error) => {
|
|
process.stderr.write(String(error && error.stack ? error.stack : error));
|
|
process.exit(1);
|
|
});
|