"""Test diff command."""

from pathlib import Path

from typer.testing import CliRunner

from apiposture_pro.cli.app import app

runner = CliRunner()


def test_diff_without_license(temp_dir: Path) -> None:
    """Test diff fails without valid license."""
    baseline = temp_dir / "baseline.json"
    baseline.write_text("{}")
    current = temp_dir / "current.json"
    current.write_text("{}")

    result = runner.invoke(app, ["diff", str(baseline), str(current)])

    assert result.exit_code == 1
    assert "No valid license found" in result.stdout


def test_diff_nonexistent_files() -> None:
    """Test diff with nonexistent files."""
    result = runner.invoke(app, ["diff", "/nonexistent/baseline.json", "/nonexistent/current.json"])

    assert result.exit_code != 0
