42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
||
"""design-story-foundation 选定交接闸离线测试。"""
|
||
import sys
|
||
from pathlib import Path
|
||
|
||
import click
|
||
|
||
PROJECT_ROOT = Path(__file__).resolve().parents[3]
|
||
SCRIPTS = PROJECT_ROOT / "muse" / "lifecycle" / "flow" / "skills" / "book" / "design-story-foundation" / "scripts"
|
||
sys.path.insert(0, str(SCRIPTS))
|
||
|
||
from assert_selection_handoff import HandoffError, assert_selection_handoff # noqa: E402
|
||
|
||
|
||
def expect_fail(payload) -> None:
|
||
try:
|
||
assert_selection_handoff(payload)
|
||
except HandoffError:
|
||
return
|
||
raise AssertionError("应失败关闭")
|
||
|
||
|
||
def main() -> None:
|
||
ok = assert_selection_handoff({
|
||
"selectedCandidate": "docs/design/candidates/A.md",
|
||
"confirmedByUser": True,
|
||
"confirmedAt": "2026-08-20T12:00:00+08:00",
|
||
})
|
||
assert ok["selectedCandidate"].endswith("A.md")
|
||
expect_fail({})
|
||
expect_fail({"selectedCandidate": "x", "confirmedByUser": False, "confirmedAt": "t"})
|
||
expect_fail({"selectedCandidate": "", "confirmedByUser": True, "confirmedAt": "t"})
|
||
try:
|
||
raise HandoffError("x")
|
||
except click.ClickException:
|
||
pass
|
||
print("PASS:selection handoff 门全部通过")
|
||
|
||
|
||
if __name__ == "__main__":
|
||
main()
|