"""
ShelfAI test suite.

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



class TestFileLock:
    """Tests for shelf file locking."""

    def test_lock_acquire_release(self, shelf_dir):
        from shelfai.core.safety import shelf_lock

        # Should acquire and release cleanly
        with shelf_lock(shelf_dir):
            assert (shelf_dir / ".shelfai" / "shelf.lock").exists()

        # Should be able to acquire again after release
        with shelf_lock(shelf_dir):
            pass

    def test_lock_creates_shelfai_dir(self, tmp_path):
        from shelfai.core.safety import shelf_lock

        new_shelf = tmp_path / "new_shelf"
        new_shelf.mkdir()

        with shelf_lock(new_shelf):
            assert (new_shelf / ".shelfai").exists()


# ──────────────────────────────────────────────
# Test: Safety — Memory Entry Counting
# ──────────────────────────────────────────────


