test_http_config.py 684 Bytes
from __future__ import annotations

from apps.web_api.bootstrap.http_config import resolve_frontend_dev_server_url


def test_resolve_frontend_dev_server_url_trims_and_strips_trailing_slash(monkeypatch):
    monkeypatch.setenv("BETTAFISH_FRONTEND_DEV_URL", " http://127.0.0.1:5173/ ")

    assert resolve_frontend_dev_server_url() == "http://127.0.0.1:5173"


def test_resolve_frontend_dev_server_url_returns_none_for_blank_or_missing(monkeypatch):
    monkeypatch.setenv("BETTAFISH_FRONTEND_DEV_URL", "   ")
    assert resolve_frontend_dev_server_url() is None

    monkeypatch.delenv("BETTAFISH_FRONTEND_DEV_URL", raising=False)
    assert resolve_frontend_dev_server_url() is None