"""
ShelfAI test suite.

Tests core functionality: shelf operations, index parsing,
transcript parsing, session management, and CLI commands.
"""



class TestFileOps:
    """Tests for file operations."""

    def test_read_shelf_file(self, shelf_dir):
        from shelfai.core.fileops import read_shelf_file

        sf = read_shelf_file(shelf_dir, "skills/code_review.md")
        assert sf.title == "Code Review"
        assert sf.file_type == "skill"
        assert "Code Review" in sf.content

    def test_list_shelf_files(self, shelf_dir):
        from shelfai.core.fileops import list_shelf_files

        files = list_shelf_files(shelf_dir)
        assert "skills/code_review.md" in files
        assert "index.md" not in files

    def test_estimate_tokens(self):
        from shelfai.core.fileops import estimate_tokens

        assert estimate_tokens("hello world") == 2  # 11 chars / 4
        assert estimate_tokens("") == 0


# ──────────────────────────────────────────────
# Test: Safety — Path Traversal Protection
# ──────────────────────────────────────────────


