"""providers/suno.py — _build_suno_payload 단위 테스트 + 1개 함수 mock 검증."""
import pytest
from providers.suno import _build_suno_payload


def test_payload_custom_mode_with_lyrics():
    params = {"lyrics": "[Verse]\nhello", "genre": "lofi", "moods": ["chill"], "model": "V4"}
    p = _build_suno_payload(params)
    assert p["customMode"] is True
    assert p["prompt"] == "[Verse]\nhello"
    assert "lofi" in p["style"]
    assert "chill" in p["style"]


def test_payload_simple_mode_no_lyrics_no_genre():
    params = {"prompt": "happy summer", "model": "V4"}
    p = _build_suno_payload(params)
    assert p["customMode"] is False
    assert "happy summer" in p["prompt"]


def test_payload_instrumental_clears_prompt():
    params = {"genre": "ambient", "instrumental": True, "model": "V5"}
    p = _build_suno_payload(params)
    assert p["instrumental"] is True
    assert p["prompt"] == ""


def test_payload_includes_optional_vocal_gender():
    params = {"genre": "pop", "vocal_gender": "f", "model": "V4"}
    p = _build_suno_payload(params)
    assert p["vocalGender"] == "f"
