/* 513-3 우클릭 「구조물 삭제」 관 아닌 구조물도(요구 327-1) — `design_pipe_ids.removeStationOwner` 를 Node 로 * 돌려 JSON 한 줄(`test_513_3_remove_station_owner.py` 가 판정). 관 장부 · 고름은 가짜 · 주인 가르기는 진짜. * node helper_513_3_remove_station_owner.cjs */ const path = require("path"); const { makeLoader } = require("./helper_ts_stub_loader.cjs"); const BOOK = { next: 4, ids: [{ id: "pipe-s3", at: 55 }] }; const STUBS = { "../b_page_state": { readState: () => BOOK, writeState() {} }, "./design_selection": { PIPE_MATCH_M: 0.51, isNear: () => false, nearestWithin: () => null, readSelection: () => null, selectDesign() {}, }, common_util_pick_tag: { setPipeTagSource() {} }, }; const { loadTs } = makeLoader({ root: path.join(__dirname, "..", ".."), stubs: STUBS }); const ids = loadTs(path.join(__dirname, "..", "..", "A00_Common", "design", "design_pipe_ids.ts")); ids.usePipeIds("p1"); const calls = []; const remove = { pipe: (m) => calls.push(["pipe", m]), structure: (id) => calls.push(["structure", id]), }; const cases = [ [{ id: "pipe-s1", chainage_m: 40 }, true], // 관 기준 측점 [{ id: "wall-7", chainage_m: 80 }, false], // 구조물 기준 측점 [{ id: "wall-8:start", chainage_m: 100 }, false], // 구간 구조물 시작 [{ id: "wall-8:end", chainage_m: 130 }, false], // 구간 구조물 끝 [{ id: "pipe-s3:end", chainage_m: 60 }, false], // 관 구간 끝 = 장부 자리 [{ id: "pipe-12.50:start", chainage_m: 10 }, false], // 옛 자리 이름 관 ]; for (const [station, pipe] of cases) ids.removeStationOwner(station, pipe, remove); process.stdout.write(JSON.stringify({ calls }));