"""Tests for screenshot media tracking."""

import pytest
import base64
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock
from nanobot.agent.loop import AgentLoop
from nanobot.agent.tools.anthropic.base import ToolResult


@pytest.mark.asyncio
async def test_media_tracking_saves_screenshots():
    """Test that screenshots are saved to disk and tracked."""
    # This is more of an integration test
    # Test the media saving logic separately

    # Create fake screenshot data
    fake_png = b"\x89PNG\r\n\x1a\n"  # PNG header
    base64_image = base64.b64encode(fake_png).decode()

    result = ToolResult(base64_image=base64_image)

    # Verify we can decode it
    decoded = base64.b64decode(result.base64_image)
    assert decoded == fake_png
