"""Tests for CLI compliance commands."""

from __future__ import annotations

from typer.testing import CliRunner

from ai4gh.cli.main import app

runner = CliRunner()


class TestListSpecs:
    def test_list_specs(self) -> None:
        result = runner.invoke(app, ["list-specs"])
        assert result.exit_code == 0
        assert "beacon" in result.output
        assert "drs" in result.output

    def test_list_specs_all_seven(self) -> None:
        result = runner.invoke(app, ["list-specs"])
        for spec in ("beacon", "drs", "wes", "tes", "trs", "htsget", "refget"):
            assert spec in result.output


class TestTestCommand:
    def test_unknown_spec(self) -> None:
        result = runner.invoke(app, ["test", "nonexistent", "http://example.com"])
        assert result.exit_code == 1

    def test_help(self) -> None:
        result = runner.invoke(app, ["test", "--help"])
        assert result.exit_code == 0
        assert "spec" in result.output.lower()
        assert "url" in result.output.lower()


class TestConfigCommands:
    def test_config_show(self) -> None:
        result = runner.invoke(app, ["config", "show"])
        assert result.exit_code == 0
        assert "Timeout" in result.output

    def test_config_help(self) -> None:
        result = runner.invoke(app, ["config", "--help"])
        assert result.exit_code == 0
        assert "show" in result.output
        assert "init" in result.output
