from autoshorts.demo.sample_batch import (
    build_sample_ai_life_systems_batch,
    render_sample_review_batch,
)
from autoshorts.review.workflow import build_review_batch


def test_sample_ai_life_systems_batch_has_ready_blocked_and_invalid_candidate():
    batch = build_sample_ai_life_systems_batch()

    assert batch.batch_id == "sample-ai-life-systems"
    assert [candidate.candidate_id for candidate in batch.candidates] == [
        "sample-ready",
        "sample-blocked",
        "sample-invalid",
    ]

    review_batch = build_review_batch(batch)

    assert [item.candidate.candidate_id for item in review_batch.ready_for_review] == ["sample-ready"]
    assert [item.candidate.candidate_id for item in review_batch.blocked] == ["sample-blocked"]
    assert [item.candidate.candidate_id for item in review_batch.invalid] == ["sample-invalid"]


def test_render_sample_review_batch_returns_telegram_safe_summary():
    text = render_sample_review_batch()

    assert "## Review Batch: sample-ai-life-systems" in text
    assert "Ready: 1" in text
    assert "Blocked: 1" in text
    assert "Invalid: 1" in text
    assert "Review: sample-ready" in text
    assert "sample-blocked —" in text
    assert "quality gate blocked candidate" in text
    assert "sample-invalid —" in text
    assert "hook is required" in text
    assert "publish" not in text.casefold()
    assert "post" not in text.casefold()
