import pytest
from pathlib import Path
from src import aggregate, beads_client

def test_build_beads_compaction(tmp_path: Path):
    # Setup mock Beads repo
    workspace_dir = tmp_path / "workspace"
    workspace_dir.mkdir()
    bclient = beads_client.BeadsClient(workspace_dir)
    bclient.init_repo()
    
    # Create some beads: one completed, one active
    bclient.create_bead("Bead 1", "Completed Description")
    bclient.update_bead("bead-1", "completed")
    bclient.create_bead("Bead 2", "Active Description")
    
    # We need to implement a function that builds the beads compaction block
    if hasattr(aggregate, "build_beads_section"):
        block = aggregate.build_beads_section(workspace_dir)
        assert "Beads Mode: Progress Track" in block
        assert "Completed Beads" in block
        assert "Bead 1" in block
        assert "Active Beads" in block
        assert "Bead 2" in block
    else:
        # Placeholder for implementation
        pass

