"""Tests for checklist 2.3 — Markdown rendering sanitization.
Verifies that _markdown() (backed by mistune HTMLRenderer with escape=True)
strips or escapes dangerous HTML before it reaches the browser. All tests
are synchronous and require no fixtures.
"""
from __future__ import annotations
import pytest
from musehub.api.routes.musehub.jinja2_filters import _markdown
# ---------------------------------------------------------------------------
# XSS / injection payloads that must NOT survive rendering
# ---------------------------------------------------------------------------
def test_script_tag_is_not_rendered() -> None:
"""Raw ")
assert "">')
assert "\n```"
result = _markdown(md)
# The raw tag must not appear
assert "