from src.models import Issue, PullRequest, Repo, User
from src.suggestion_engine import compute


def test_suggest_review_when_more_prs_than_issues():
    user = User(id=1, login="timmy", full_name="Timmy", email="timmy@example.com")
    prs = [PullRequest(id=1, number=1, title="p", state="open", user="timmy", url="http://example.com")]
    ctx = compute(user, [], [], prs)
    assert [d for d in getattr(ctx, "deltas", []) if d.panel == "review"]


def test_suggest_triage_when_open_issues():
    user = User(id=1, login="timmy", full_name="Timmy", email="timmy@example.com")
    issues = [Issue(id=1, number=1, title="t", state="open", labels=["P0"], assignees=[], url="http://example.com")]
    ctx = compute(user, [], issues, [])
    assert [d for d in getattr(ctx, "deltas", []) if d.panel == "triage"]
