Files
Aislo/resources/tester/helper_173_6_half_width.cjs
T
eomsangdonandClaude Opus 5.5 341e83114e fix(446 B06 표본 넓힘): 카드 폭 넘김 다시 만들기가 측점 설계 · 표준 횡단면 · 유토 풍선 · 계획고 편집 옮겨 담음 · 다시 만들기 전 확인창
- 반폭 재생성 = 옛 횡단 행 data · 상태를 측점 열쇠(0.01 m)로 새 행에 · 옛 종단 data 사용자 키(표준 횡단면 · 유토 · 계획 입력 · 상태) — 같은 트랜잭션
- 계획고 편집 = 옛 계획선 통째(_carry_profile 같은 노선 갈래) · 실패면 종 · 횡단 파일 되돌림
- 넓힌 지반 위 [저장]과 같은 서버 재계산
- 화면 = 다시 만들기 전 확인창 · 취소면 재생성 없음 · 오버레이 셈 짝

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Se7ytqbohmBQnfYpwYFnYf
2026-10-18 18:42:21 +09:00

52 lines
2.2 KiB
JavaScript

/* 횡단 보기 반폭 [적용](PLAN 173-6) 단위검증 헬퍼 — `createSampleWidener` 를 그 자리에서 트랜스파일해 돌린다.
* 보유 샘플(20 m) 안 요청은 재생성 없이 true · 넘는 요청만 재생성 한 번. 결과는 표준출력에 JSON 한 벌.
* 짝 = `test_173_6_half_width_apply.py`.
*/
const fs = require("fs");
const path = require("path");
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
const ROOT = path.join(__dirname, "..", "..");
const calls = { regenerate: [], overlay: 0 };
const STUBS = {
"@ui/ui_template_locale": {
currentLanguageIndex: 0,
ui_locales: new Proxy({}, { get: () => [""] }),
},
"@ui/ui_template_elements": {
showLoadingOverlay: () => calls.overlay++,
hideLoadingOverlay: () => {},
showToast: () => {},
showConfirmDialog: async () => true, // 다시 만들기 확인창(446) — 이 시험은 늘 확인
},
"./B06_Section_Api_Fetch": {
regenerateSections: async (_p, _r, width) => calls.regenerate.push(width),
},
// 다시 받기 = 공유 캐시 길(초안 측점 · 그림 자료 · 323-4)
"./B06_Section_Section_Store": { loadSectionDetail: async () => ({ cross_sections: [] }) },
};
const file = path.join(ROOT, "B06_Section", "B06_Section_UI_Page_Common.ts");
const js = ts.transpileModule(fs.readFileSync(file, "utf8"), {
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
}).outputText;
const box = { exports: {} };
new Function("exports", "module", "require", js)(box.exports, box, (r) => STUBS[r]);
(async () => {
let sampled = 20;
const widen = box.exports.createSampleWidener({
target: () => ({ projectId: "p", routeId: 1 }),
sampledHalfWidth: () => sampled,
applyDetail: () => (sampled = calls.regenerate.at(-1)),
});
const out = {};
out.within = [await widen(10), await widen(15), await widen(20)];
out.withinCalls = calls.regenerate.length;
out.over = await widen(25);
out.overCalls = [...calls.regenerate];
out.again = await widen(25); // 넓힌 뒤 같은 값은 재생성 없음
out.againCalls = calls.regenerate.length;
process.stdout.write(JSON.stringify(out));
})();