from app.presentation.tool_renderers import render_contas_vas


def test_vas_renderer_includes_available_values():
    result = {
        "products": [
            {"name": "TIM Fashion Mensal", "can": {"cancel": True}, "details": {"valor": "10,00"}},
            {"name": "Aya Audiobooks Premium", "can": {"cancel": True}, "details": {"valor": "9,99"}},
            {"name": "Neymar Jr", "can": {"cancel": True}, "details": {"valor": "12,00"}},
            {"name": "Tamboro Mensal", "can": {"cancel": True}, "details": {"valor": "14,99"}},
        ]
    }
    text = render_contas_vas(tool_name="consultar_vas", result=result, state={}, agent_label="VasAgent")
    assert "TIM Fashion Mensal (avulso): R$ 10,00" in text
    assert "Aya Audiobooks Premium (avulso): R$ 9,99" in text
    assert "Neymar Jr (avulso): R$ 12,00" in text
    assert "Tamboro Mensal (avulso): R$ 14,99" in text


def test_vas_renderer_does_not_invent_missing_value():
    result = {"products": [{"name": "Sem Preço", "can": {"cancel": True}, "details": {}}]}
    text = render_contas_vas(tool_name="consultar_vas", result=result, state={}, agent_label="VasAgent")
    assert "Sem Preço (avulso)" in text
    assert "R$" not in text
