from kbqa.indexing.loaders import LoadedPage
from kbqa.indexing.splitter import split_pages


def test_split_pages_is_deterministic() -> None:
    document_id = "12345678-1234-5678-1234-567812345678"
    pages = [LoadedPage(content="知识库" * 300, page_number=1)]
    first = split_pages(document_id, pages, 100, 10)
    second = split_pages(document_id, pages, 100, 10)
    assert [chunk.id for chunk in first] == [chunk.id for chunk in second]
    assert first[0].page_number == 1
    assert [chunk.order_index for chunk in first] == list(range(len(first)))
