- 판정 = 저장 노선 대 초안이 그릴 선 정점 1 mm(`routeShapeChanged` · 파이썬 `route_shape_changed` 짝) · 스냅 · 간격 · 지형만 = 아님 - 띠 = 평면(노선 편집) 위 한 줄 · B06 평면 패널로 같이 옮겨짐 · 저장 노선 = 페이지 자료 줄 `pageRoutePlan`(조작마다 안 물음) - [저장] 확인 창 = 잠금 막 · 서버 요청 앞 · 구조물 · 관 · 추가 측점 · 종단 편집 수 · [취소] = 요청 0 · 추천 [적용] 같은 글 · 수 - 저장 뒤 = 응답 `steps.route.route_reset` 지운 수 한 줄 · 초기화면 세션 초안 통째 비움 → 서버 정본으로 다시 세움 · 옛 서버(칸 없음) = 알림 건너뜀 - 시험: 새 test_283_route_reset_confirm(띠 · 확인 창 수 · [취소] · 스냅만 · 거울) · 저장 헬퍼 셋 확인 창 가짜 · 476-2 확인 글 기대 고침 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
71 lines
2.8 KiB
JavaScript
71 lines
2.8 KiB
JavaScript
/* 472-5 남음 헬퍼 — 노선 바뀐 [저장] 뒤 옛 노선 세션 칸 · 초안 전 hold 비움(`design_save.ts` 그대로 · 서버 창구 ·
|
|
* 세션 창구는 가짜). 짝 = `test_472_5r_rock_owner.py`. 표준출력 JSON. */
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
|
|
|
|
const ROOT = path.join(__dirname, "..", "..");
|
|
globalThis.window = { setTimeout, clearTimeout };
|
|
|
|
const anything = () =>
|
|
new Proxy({}, { get: (_target, key) => (key === "__esModule" ? false : () => undefined) });
|
|
|
|
function load(file, stubs) {
|
|
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] ?? anything());
|
|
return box.exports;
|
|
}
|
|
|
|
async function once(newRouteId, fail) {
|
|
const calls = [];
|
|
const KEYS = ["settings", "pipes", "structures", "plusStations", "alignment"];
|
|
const save = load(path.join(ROOT, "A00_Common", "design", "design_save.ts"), {
|
|
"../b_page_state": {
|
|
clearRouteDrafts: (p, r) => calls.push(`clearRouteDrafts:${p}:${r}`),
|
|
clearState: (name, p) => calls.push(`clearState:${name}:${p}`),
|
|
stateKey: () => null,
|
|
},
|
|
"./design_save_api": {
|
|
SAVE_PART_KEYS: [...KEYS, "cross"],
|
|
DesignSaveError: Error,
|
|
postDesignSave: async () => {
|
|
calls.push("post");
|
|
if (fail) throw new Error("서버 500");
|
|
return { waited: false, steps: { route: { route_id: newRouteId } } };
|
|
},
|
|
},
|
|
// 492-2 노선 모양 바뀜 확인 창 — 이 시험은 묻지 않음(test_283_route_reset_confirm)
|
|
"../../B05_Profile/B05_Profile_UI_RouteReset": { confirmRouteReset: async () => true },
|
|
"../../B05_Profile/B05_Profile_UI_RouteEdit_Apply": {
|
|
pendingRouteSave: async () => ({ draft: 1 }),
|
|
routeCarryPart: () => ({ carry: {}, cross: { body: {} } }),
|
|
routeSaved: () => calls.push("routeSaved"),
|
|
routeSaveSummary: () => "",
|
|
rebuildAfterRouteSave: async () => calls.push("rebuild"),
|
|
},
|
|
});
|
|
const done = await save.saveDesign({
|
|
projectId: "p1",
|
|
routeId: () => 3,
|
|
crossPart: async () => null,
|
|
failed: () => calls.push("failed"),
|
|
});
|
|
// 저장 뒤 정리와 무관한 칸(종류 캐시)은 빼고 봄
|
|
return { done, calls: calls.filter((c) => !c.includes("structure-type-cache")) };
|
|
}
|
|
|
|
(async () => {
|
|
const out = {
|
|
moved: await once(9, false),
|
|
same: await once(3, false),
|
|
failed: await once(9, true),
|
|
};
|
|
process.stdout.write(JSON.stringify(out));
|
|
})().catch((error) => {
|
|
process.stderr.write(String(error.stack || error));
|
|
process.exit(1);
|
|
});
|