MCPcopy Index your code
hub / github.com/github/spec-kit / test_execute_matches_case

Method test_execute_matches_case

tests/test_workflows.py:1725–1744  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1723 """Test the switch step type."""
1724
1725 def test_execute_matches_case(self):
1726 from specify_cli.workflows.steps.switch import SwitchStep
1727 from specify_cli.workflows.base import StepContext
1728
1729 step = SwitchStep()
1730 ctx = StepContext(
1731 steps={"review": {"output": {"choice": "approve"}}}
1732 )
1733 config = {
1734 "id": "route",
1735 "expression": "{{ steps.review.output.choice }}",
1736 "cases": {
1737 "approve": [{"id": "plan", "command": "speckit.plan"}],
1738 "reject": [{"id": "log", "type": "shell", "run": "echo rejected"}],
1739 },
1740 "default": [{"id": "abort", "type": "gate", "message": "Unknown"}],
1741 }
1742 result = step.execute(config, ctx)
1743 assert result.output["matched_case"] == "approve"
1744 assert result.next_steps[0]["id"] == "plan"
1745
1746 def test_execute_falls_to_default(self):
1747 from specify_cli.workflows.steps.switch import SwitchStep

Callers

nothing calls this directly

Calls 3

executeMethod · 0.95
SwitchStepClass · 0.90
StepContextClass · 0.90

Tested by

no test coverage detected