"""Unit tests for terminal tool."""

import pytest

from navi.tools.terminal import TerminalTool


class TestTerminalTool:
    @pytest.fixture
    def tool(self):
        return TerminalTool()

    async def test_echo(self, tool):
        result = await tool.execute({"command": "echo hello"})
        assert result.success
        assert "hello" in result.output

    async def test_pwd(self, tool):
        result = await tool.execute({"command": "pwd"})
        assert result.success
        assert "/" in result.output

    async def test_empty_command(self, tool):
        result = await tool.execute({"command": "  "})
        assert not result.success
        assert "empty" in result.output.lower()

    async def test_invalid_command(self, tool):
        result = await tool.execute({"command": "this_command_does_not_exist_12345"})
        assert not result.success
