- 좌측 「구조물 집계 양식」 아래 「항목 나무」 카드(세 층 공용 · 깊이 자유 · 검색 · 키보드 위아래 · 펼침 · F2 · Delete)
- 항목 누름 → 표 그 열 고름 + 카드 넷 · 표에서 열 고름 → 나무 표시
- 나무 고침 POST /api/m02/layers/{층}/tree · 판 409 다시 읽고 알림 · 저장 안 한 표 고침은 저장/버림/취소 물음
- 읽기만 층은 메뉴 · 키 없음 · 나무 메뉴 자리는 sub5 의 ui_template_tree 그대로
- 시험 test_m02_treepanel 8 · test_m02_layer_screen 문구 맞춤
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D2nUMUMTsqm93PbQtipo6c
81 lines
2.6 KiB
Python
81 lines
2.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""M02 관리 화면 항목 나무(PLAN 26-3a) 자료 셈 회귀검증 — 폴더 나무 · 빈 폴더 · 깊이 5 · 찾기 · 폴더 목록.
|
|
|
|
항목 경로 = 폴더 이름 배열 + 마지막 마디가 항목 이름 · 찾는 글이 있으면 맞는 항목과 위 폴더만.
|
|
Node 헬퍼(`helper_m02_treepanel.cjs`)가 TS 를 트랜스파일해 돌리고, 여기서 값을 판정한다.
|
|
"""
|
|
|
|
import json
|
|
import os
|
|
import subprocess
|
|
|
|
import pytest
|
|
|
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def results():
|
|
proc = subprocess.run(
|
|
["node", os.path.join(HERE, "helper_m02_treepanel.cjs")],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=60,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
def test_빈_폴더도_나무에_있음(results):
|
|
tops = [f["path"] for f in results["all"]["folders"]]
|
|
assert ["빈 폴더"] in tops
|
|
dol = next(f for f in results["all"]["folders"] if f["path"] == ["돌기슭막이"])
|
|
assert ["돌기슭막이", "빈 아래"] in [f["path"] for f in dol["folders"]]
|
|
|
|
|
|
def test_맨_위_항목은_폴더_밖(results):
|
|
assert results["all"]["items"] == ["c4"]
|
|
assert results["count"] == 4
|
|
|
|
|
|
def test_깊이_5_항목까지_이어짐(results):
|
|
node = next(f for f in results["all"]["folders"] if f["path"] == ["다섯"])
|
|
for depth in range(2, 5):
|
|
node = node["folders"][0]
|
|
assert len(node["path"]) == depth
|
|
assert node["items"] == ["c3"]
|
|
|
|
|
|
def test_찾기는_맞는_항목과_위_폴더만(results):
|
|
assert results["foundCount"] == 1
|
|
assert [f["path"] for f in results["found"]["folders"]] == [["돌기슭막이"]]
|
|
assert results["found"]["folders"][0]["items"] == ["c2"] # 빈 폴더는 안 보임
|
|
assert results["none"] == {"path": [], "items": [], "folders": []}
|
|
|
|
|
|
def test_키로도_찾음(results):
|
|
assert results["byKey"] == 1
|
|
|
|
|
|
def test_폴더_목록과_위_길(results):
|
|
assert ["다섯", "둘", "셋", "넷"] in results["folders"]
|
|
assert ["빈 폴더"] in results["folders"]
|
|
assert results["ancestors"] == [
|
|
["다섯"],
|
|
["다섯", "둘"],
|
|
["다섯", "둘", "셋"],
|
|
["다섯", "둘", "셋", "넷"],
|
|
]
|
|
assert results["ancestorsTop"] == []
|
|
assert results["ancestorsNone"] == []
|
|
|
|
|
|
def test_안_또는_같음_판정(results):
|
|
assert results["under"] == [True, True, False, False]
|
|
|
|
|
|
def test_잎_이름과_폴더(results):
|
|
assert results["leaf"] == "1.2m"
|
|
assert results["dir"] == ["돌기슭막이", "메쌓기"]
|