"""Tests pour la commande CLI doctor."""

import pytest
from typer.testing import CliRunner

from pricewatch.app.cli.main import app

runner = CliRunner()


class TestDoctorCommand:
    """Tests pour la commande doctor."""

    def test_doctor_success(self):
        """Doctor doit afficher le statut de l'installation."""
        result = runner.invoke(app, ["doctor"])
        assert result.exit_code == 0
        assert "PriceWatch Doctor" in result.stdout
        assert "Python" in result.stdout
        # "prêt" avec accent
        assert "prêt" in result.stdout.lower() or "ready" in result.stdout.lower()

    def test_doctor_shows_dependencies(self):
        """Doctor doit lister les dependances."""
        result = runner.invoke(app, ["doctor"])
        assert result.exit_code == 0
        assert "typer" in result.stdout.lower()
        assert "pydantic" in result.stdout.lower()
        assert "playwright" in result.stdout.lower()

    def test_doctor_shows_stores(self):
        """Doctor doit lister les stores disponibles."""
        result = runner.invoke(app, ["doctor"])
        assert result.exit_code == 0
        assert "amazon" in result.stdout.lower()
        assert "cdiscount" in result.stdout.lower()
