from a11yviz import check_palette


def test_black_on_white_passes_aa_and_aaa():
    rows = check_palette(["#000000"], bg="#ffffff", level="AA")
    assert rows[0]["status"] == "ok"
    assert rows[0]["ratio"] > 20


def test_light_gray_on_white_fails_aa():
    rows = check_palette(["#cccccc"], bg="#ffffff", level="AA")
    assert rows[0]["status"] == "todo"


def test_aaa_threshold_rejects_aa_only_colors():
    rows = check_palette(["#0072B2"], bg="#ffffff", level="AAA")
    assert rows[0]["status"] == "todo"


def test_returns_one_row_per_color():
    rows = check_palette(["#000000", "#ffffff", "#888888"])
    assert len(rows) == 3
    assert set(rows[0].keys()) == {"color", "bg", "ratio", "status"}
