from autoshorts.scripting.quality import ScriptQualityScore, should_render


def test_script_renders_when_score_meets_threshold_and_no_policy_block():
    score = ScriptQualityScore(
        hook_strength=9,
        novelty=8,
        clarity=9,
        retention=8,
        ai_slop_risk=2,
        policy_risk="low",
    )

    assert should_render(score) is True


def test_script_does_not_render_below_quality_threshold():
    score = ScriptQualityScore(
        hook_strength=6,
        novelty=6,
        clarity=7,
        retention=6,
        ai_slop_risk=3,
        policy_risk="low",
    )

    assert should_render(score) is False


def test_script_does_not_render_when_ai_slop_risk_is_too_high():
    score = ScriptQualityScore(
        hook_strength=9,
        novelty=8,
        clarity=9,
        retention=8,
        ai_slop_risk=8,
        policy_risk="low",
    )

    assert should_render(score) is False


def test_script_does_not_render_when_policy_risk_is_high():
    score = ScriptQualityScore(
        hook_strength=10,
        novelty=10,
        clarity=10,
        retention=10,
        ai_slop_risk=1,
        policy_risk="high",
    )

    assert should_render(score) is False
