import app.providers.stt.faster_whisper as fw
from app.config import settings


def test_stt_config_defaults():
    assert settings.faster_whisper_model == "small"
    assert settings.faster_whisper_compute_type == "int8"
    assert settings.stt_force_language is True


class _Seg:
    def __init__(self, text):
        self.text = text


class _Info:
    language = "de"


def test_transcribe_passes_vad_and_language(monkeypatch):
    captured = {}

    class _FakeModel:
        def transcribe(self, audio, **kw):
            captured.update(kw)
            return [_Seg("hallo welt")], _Info()

    monkeypatch.setattr(fw, "_load_model", lambda *a, **k: _FakeModel())
    prov = fw.FasterWhisperProvider(model_size="small", device="cpu", compute_type="int8")
    text, detected = prov._transcribe_sync(b"AAAA", "de")
    assert text == "hallo welt" and detected == "de"
    assert captured["language"] == "de"
    assert captured["vad_filter"] is True
    assert captured["condition_on_previous_text"] is False
