| # ============================================================ | |
| # 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" |