Files
lda-wf/tests/wf_api/test_listing.py
T
lda Verified 69de023a89 organize the Helper Functions
those who make the program. the helper functions. they deserve better Ahh
2026-06-02 03:17:50 +07:00

27 lines
844 B
Python

from __future__ import annotations
from wf_api.listing import matches_query, paged_list_payload
def test_matches_query_accepts_empty_or_missing_query() -> None:
assert matches_query("Alpha", query=None) is True
assert matches_query("Alpha", query=" ") is True
def test_matches_query_searches_non_none_values_case_insensitively() -> None:
assert matches_query(None, "Demo Echo", query="echo") is True
assert matches_query(None, "Demo Echo", query="missing") is False
def test_paged_list_payload_preserves_common_shape() -> None:
payload = paged_list_payload(
"nodes",
[{"name": "a"}, {"name": "b"}, {"name": "c"}],
cursor=None,
limit=2,
)
assert payload["nodes"] == [{"name": "a"}, {"name": "b"}]
assert payload["total"] == 3
assert payload["next_cursor"] is not None