/* 717-1 헬퍼 — 상세 부품 길 주입 · 가짜 fetch 로 부른 주소만 모음. 짝 = `test_717_1_logic_lib.py`. */ const path = require("path"); const { makeLoader } = require("./helper_ts_stub_loader.cjs"); const ROOT = path.join(__dirname, "..", ".."); const { load } = makeLoader({ root: ROOT, stubs: { M01_MasterData_UI_Logic_Edit: {}, M01_MasterData_UI_Logic_Text: {} }, }); const urls = []; global.fetch = async (url) => { urls.push(String(url).replace("http://fake", "")); return { ok: true, status: 200, statusText: "", json: async () => ({ logics: [], subs: [], items: [], rows: [] }), }; }; const api = load("M01_MasterData", "M01_MasterData_UI_Logic_Api.ts"); const rows = load("M01_MasterData", "M01_MasterData_Api_Fetch.ts"); const note = load("M01_MasterData", "M01_MasterData_UI_Logic_Note.ts"); async function round(tag) { await api.fetchLogic("K"); await api.fetchAuto("K"); await api.searchElements("재료", "q"); await api.fetchMaterials({ sub: "s" }); await api.runCalc({ key: "K", inputs: {} }); await api.runText({ key: "K", inputs: {} }); await rows.fetchRows("기계.json", 1, 5, "q"); await rows.fetchPick("price", "q"); await note.loadTable(`T-${tag}`); await rows.fetchGroups(); // 관리자 길 — 늘 /m01 await api.saveFiles([]); // 저장 — 늘 /m01 return urls.splice(0).map((u) => u.split("?")[0]); } (async () => { const out = { before: await round("a") }; api.setLogicApiPaths({ read: "/m02/logic-lib", calc: "/m02/calc-x" }); out.injected = await round("b"); api.setLogicApiPaths(); out.after = await round("c"); process.stdout.write(JSON.stringify(out)); })();