# retoor <retoor@molodetz.nl>
from devplacepy.services.devii.interaction.markdown import (
project_markdown,
project_plain_menu,
)
from devplacepy.services.devii.interaction.schema import validate_prompt_args
def _request():
return validate_prompt_args(
{
"title": "Deploy to staging?",
"description": "Ship the current build.",
"widgets": [
{
"type": "choice",
"name": "env",
"label": "Target environment",
"default": "staging",
"options": [
{"value": "production", "label": "Production"},
{"value": "staging", "label": "Staging"},
{"value": "dev", "label": "Development"},
],
},
{
"type": "text",
"name": "notes",
"label": "Ship notes",
"required": False,
"max_length": 200,
},
],
}
)
def test_markdown_projection_has_title_and_id():
md = project_markdown(_request(), "ix-a1b2")
assert "### Deploy to staging?" in md
assert "`staging`" in md
assert "<!-- ai-interaction:ix-a1b2 -->" in md
assert "[Confirm]" in md
def test_plain_menu_for_confirm():
req = validate_prompt_args(
{
"title": "Delete?",
"widgets": [
{"type": "confirm", "name": "delete", "label": "Delete", "default": False}
],
}
)
text = project_plain_menu(req)
assert "yes | no" in text.lower() or "Reply: yes" in text