from __future__ import annotations

from orchestrator.ulid import new_ulid


def test_ulid_length_and_alphabet() -> None:
    u = new_ulid()
    assert len(u) == 26
    assert all(c in "0123456789ABCDEFGHJKMNPQRSTVWXYZ" for c in u)


def test_ulid_uniqueness_burst() -> None:
    seen = {new_ulid() for _ in range(2000)}
    assert len(seen) == 2000


def test_ulid_time_sortable() -> None:
    earlier = new_ulid(now_ms=1_700_000_000_000)
    later = new_ulid(now_ms=1_700_000_001_000)
    assert earlier < later
