"""CLI tests — invoke the Typer app via CliRunner."""

from __future__ import annotations

from typer.testing import CliRunner

from {{ cookiecutter.project_name }}.cli import app


def test_hello_default(runner: CliRunner) -> None:
    """``hello`` with no arg greets the world."""
    result = runner.invoke(app, ["hello"])
    assert result.exit_code == 0
    assert "Hello, world!" in result.stdout


def test_hello_name(runner: CliRunner) -> None:
    """``hello <name>`` greets the given name."""
    result = runner.invoke(app, ["hello", "Alice"])
    assert result.exit_code == 0
    assert "Hello, Alice!" in result.stdout


def test_version(runner: CliRunner) -> None:
    """``version`` prints the package version."""
    result = runner.invoke(app, ["version"])
    assert result.exit_code == 0
    assert "0.1.0" in result.stdout


def test_no_args_shows_help(runner: CliRunner) -> None:
    """No args → help (no_args_is_help=True)."""
    result = runner.invoke(app, [])
    assert result.exit_code != 0 or "Usage" in result.stdout