File size: 738 Bytes
54d246d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# ============================================================
# FILE: tests/test_document_loader.py
# ============================================================
# PURPOSE:
# Basic test for loading text files.
# ============================================================

from pathlib import Path

from src.document_loader import load_documents


def test_load_text_document(tmp_path: Path):
    sample_file = tmp_path / "sample.txt"
    sample_file.write_text("Hello from KnowFlow AI.", encoding="utf-8")

    documents = load_documents(
        folder=tmp_path,
        project_root=tmp_path,
    )

    assert len(documents) == 1
    assert documents[0].text == "Hello from KnowFlow AI."
    assert documents[0].file_type == ".txt"