"""Tests for `tu tasks pull` output path resolution."""

from __future__ import annotations

from pathlib import Path

from terminaluse.lib.cli.commands import tasks as tasks_cmd


def test_resolve_pull_output_path_uses_default_when_out_missing():
    """Default output path should be ./task-<task_id>."""
    resolved = tasks_cmd._resolve_pull_output_path(task_id="task-abc123", out_flag=None)

    assert resolved == Path("./task-task-abc123").resolve()


def test_resolve_pull_output_path_uses_out_flag_when_provided():
    """Explicit --out should override default path."""
    resolved = tasks_cmd._resolve_pull_output_path(task_id="task-abc123", out_flag="./custom-output")

    assert resolved == Path("./custom-output").resolve()
