# Copyright (c) 2026 MergeGuide, Inc. All rights reserved.
# SPDX-License-Identifier: Proprietary
"""Tests for MergeGuide CLI."""

from click.testing import CliRunner

from mergeguide import __version__
from mergeguide.cli import main


def test_cli_version() -> None:
    """Test that CLI shows version."""
    runner = CliRunner()
    result = runner.invoke(main, ["--version"])
    assert result.exit_code == 0
    # Click normalizes PEP 440 versions (e.g., "2.0.0-rc.2" → "2.0.0rc2").
    # Check that the major.minor.patch prefix is present.
    version_base = __version__.split("-")[0].split("rc")[0].rstrip(".")
    assert version_base in result.output


def test_cli_help() -> None:
    """Test that CLI shows help."""
    runner = CliRunner()
    result = runner.invoke(main, ["--help"])
    assert result.exit_code == 0
    assert "MergeGuide" in result.output
