"""Jira AC extraction unit tests."""

from packages.integrations.jira import _extract_ac


def test_extract_ac_from_description_without_header():
    description = """Add a Customer_Tier__c picklist on the Account object with values Bronze, Silver, and Gold.
Add a validation rule so that selecting Gold requires AnnualRevenue >= 100000.
Use standard ENG naming conventions. Prefer configuration over Apex."""
    ac = _extract_ac(description)
    assert len(ac) >= 2
    assert any("picklist" in line.lower() for line in ac)
    assert any("validation" in line.lower() for line in ac)


def test_extract_ac_with_explicit_header():
    description = """Some intro text.

Acceptance criteria:
1. Customer_Tier__c picklist exists on Account
2. Validation rule blocks Gold when AnnualRevenue < 100000
"""
    ac = _extract_ac(description)
    assert len(ac) == 2
    assert "Customer_Tier__c picklist exists on Account" in ac[0]
