Files
Aislo/resources/tester/helper_347_2_drainage_live.cjs
T
eomsangdonandClaude Sonnet 5.5 8bbdbb9f69 test(508-1b 옛 헬퍼 공용 불러오기 4/7): 헬퍼 28 곳 loadTs 베낌 걷고 makeLoader 로
- 헬퍼 동작 그대로(풀이 함수 본문은 옮겨 담음) · 제품 코드 안 고침
- 확인: 이 묶음 헬퍼를 쓰는 시험 236 개 전 230 통과 → 후 230 통과 (시험별 junit 대조 · 어긋남 0)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 17:11:59 +09:00

56 lines
2.2 KiB
JavaScript

/* 347-2 · 347-3 배수유역 자동/수동 · 제안 헬퍼 — logic 두 파일을 그 자리에서 트랜스파일해
* Node 로 돌리고 값을 JSON 으로 낸다(틀 = helper_281_1).
*/
const fs = require("fs");
const path = require("path");
const { makeLoader } = require("./helper_ts_stub_loader.cjs");
const ROOT = path.join(__dirname, "..", "..");
const { loadTs } = makeLoader({
root: ROOT,
cache: false,
requireFor: () => require,
});
const live = loadTs(path.join(ROOT, "B05_Profile", "logic", "B05_Profile_Drainage_Live.ts"));
const sug = loadTs(path.join(ROOT, "B05_Profile", "logic", "B05_Profile_Drainage_Suggest.ts"));
const pipes = [
{ chainage_m: 100, source: "stream", options: { pipe_diameter_mm: 1000 } },
{ chainage_m: 300, source: "user", facility: "pipe" },
{ chainage_m: 500, source: "stream", facility: "box_culvert" },
];
const basins = [
{ chainage_m: 100, recommended_facility: "pipe", recommended_diameter_mm: 1200 },
{ chainage_m: 300, recommended_facility: "ford_bridge", recommended_diameter_mm: null },
{ chainage_m: 500, recommended_facility: "box_culvert", recommended_diameter_mm: null },
];
const candidates = [{ chainage_m: 200 }, { chainage_m: 500.2 }];
const before = JSON.stringify(pipes);
const at = (generation) => ({ generation, key: "k" }); // 349 — 차례 + 입력 지문
const suggestions = sug.collectSuggestions(pipes, basins, candidates);
const applied = sug.applySuggestions(pipes, suggestions);
process.stdout.write(
JSON.stringify({
quietMs: live.QUIET_MS,
modes: [
live.parseDrainageMode(null),
live.parseDrainageMode("auto"),
live.parseDrainageMode("x"),
],
stale: [live.draftMakesStale(null), live.draftMakesStale({ rev: 1 })],
accept: [
live.acceptLive({ status: "success", generation: 3 }, at(3), at(3)),
live.acceptLive({ status: "success", generation: 3 }, at(3), at(4)),
live.acceptLive({ status: "superseded" }, at(3), at(3)),
live.acceptLive({ status: "success", generation: 2 }, at(3), at(3)),
],
body: live.liveRequestBody(5, undefined, [{ chainage_m: 1 }]),
suggestions,
applied,
untouched: JSON.stringify(pipes) === before,
}),
);