37 lines
1.5 KiB
Python
37 lines
1.5 KiB
Python
import pytest
|
|
from pathlib import Path
|
|
from aggregate import build_tier1_context, build_tier2_context, build_tier3_context
|
|
|
|
def test_build_tier1_context_exists():
|
|
# This should fail if the function is not defined
|
|
file_items = [
|
|
{"path": Path("conductor/product.md"), "entry": "conductor/product.md", "content": "Product content", "error": False},
|
|
{"path": Path("other.py"), "entry": "other.py", "content": "Other content", "error": False}
|
|
]
|
|
history = ["User: hello", "AI: hi"]
|
|
|
|
result = build_tier1_context(file_items, Path("."), [], history)
|
|
|
|
assert "Product content" in result
|
|
# other.py should be summarized, not full content in a code block
|
|
assert "Other content" not in result or "Summarized" in result # Assuming summary format
|
|
|
|
def test_build_tier2_context_exists():
|
|
file_items = [
|
|
{"path": Path("other.py"), "entry": "other.py", "content": "Other content", "error": False}
|
|
]
|
|
history = ["User: hello"]
|
|
result = build_tier2_context(file_items, Path("."), [], history)
|
|
assert "Other content" in result
|
|
|
|
def test_build_tier3_context_exists():
|
|
file_items = [
|
|
{"path": Path("focus.py"), "entry": "focus.py", "content": "Focus content", "error": False},
|
|
{"path": Path("other.py"), "entry": "other.py", "content": "Other content", "error": False}
|
|
]
|
|
history = ["User: hello"]
|
|
result = build_tier3_context(file_items, Path("."), [], history, focus_files=["focus.py"])
|
|
|
|
assert "Focus content" in result
|
|
assert "Other content" not in result
|