"""Tests for the WideTorah SDK client."""

from __future__ import annotations

from widetorah import WideTorah, __version__


def test_version() -> None:
    assert __version__ == "0.1.0"


def test_client_init() -> None:
    client = WideTorah()
    assert client._client.base_url == "https://widetorah.com/api/v1/torah/"
    client.close()


def test_client_custom_url() -> None:
    client = WideTorah(base_url="http://localhost:8000")
    assert client._client.base_url == "http://localhost:8000/api/v1/torah/"
    client.close()


def test_client_trailing_slash() -> None:
    client = WideTorah(base_url="https://widetorah.com/")
    assert client._client.base_url == "https://widetorah.com/api/v1/torah/"
    client.close()


def test_context_manager() -> None:
    with WideTorah() as client:
        assert client._client is not None
