import sys
from pathlib import Path

sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "apps" / "worker"))

from worker_app.core.asset_types import infer_mime_type_from_storage_key


def test_infer_mime_type_treats_mov_as_video():
    assert infer_mime_type_from_storage_key("uploads/abc/DBLQ7915.MOV") == "video/quicktime"


def test_infer_mime_type_treats_common_video_extensions_as_video():
    for filename in ["clip.mp4", "clip.m4v", "clip.avi", "clip.mkv", "clip.webm"]:
        assert infer_mime_type_from_storage_key(f"uploads/abc/{filename}") == "video/mp4"


def test_infer_mime_type_keeps_unknown_files_as_image_placeholder():
    assert infer_mime_type_from_storage_key("uploads/abc/photo.jpg") == "image/jpeg"
