refactor: #85 T9 extrait realtime et render vers modules dedies (comportement inchange)
This commit is contained in:
+14
-14
@@ -624,44 +624,44 @@ class TestHumanizeMtime:
|
||||
|
||||
class TestHeadingSlugify:
|
||||
def test_slugify_simple(self):
|
||||
from backend.main import _heading_slugify
|
||||
from backend.render import _heading_slugify # ROADMAP #85 T9 — déménagé depuis backend.main
|
||||
assert _heading_slugify("Hello World") == "hello-world"
|
||||
|
||||
def test_slugify_accented(self):
|
||||
from backend.main import _heading_slugify
|
||||
from backend.render import _heading_slugify # ROADMAP #85 T9 — déménagé depuis backend.main
|
||||
result = _heading_slugify("Café Crème")
|
||||
assert "cafe" in result or "caf" in result
|
||||
|
||||
def test_slugify_strips_symbols(self):
|
||||
from backend.main import _heading_slugify
|
||||
from backend.render import _heading_slugify # ROADMAP #85 T9 — déménagé depuis backend.main
|
||||
result = _heading_slugify("Hello, World! Test?")
|
||||
assert result.startswith("hello")
|
||||
|
||||
|
||||
class TestRenderMarkdown:
|
||||
def test_render_basic(self):
|
||||
from backend.main import _render_markdown
|
||||
from backend.render import _render_markdown # ROADMAP #85 T9 — déménagé depuis backend.main
|
||||
result = _render_markdown("# Hello\n\nThis is a test.", "TestVault")
|
||||
assert "<h1" in result
|
||||
assert "Hello" in result
|
||||
|
||||
def test_render_with_code(self):
|
||||
from backend.main import _render_markdown
|
||||
from backend.render import _render_markdown # ROADMAP #85 T9 — déménagé depuis backend.main
|
||||
result = _render_markdown("```python\nprint('hello')\n```", "TestVault")
|
||||
assert "code" in result or "highlight" in result
|
||||
|
||||
def test_render_with_heading_ids(self):
|
||||
from backend.main import _render_markdown
|
||||
from backend.render import _render_markdown # ROADMAP #85 T9 — déménagé depuis backend.main
|
||||
result = _render_markdown("# Title\n## Subtitle", "TestVault")
|
||||
assert "id=" in result
|
||||
|
||||
def test_render_wikilink(self):
|
||||
from backend.main import _render_markdown
|
||||
from backend.render import _render_markdown # ROADMAP #85 T9 — déménagé depuis backend.main
|
||||
result = _render_markdown("Link [[nonexistent.md]] here", "TestVault")
|
||||
assert "wikilink" in result
|
||||
|
||||
def test_render_image_wikilink(self):
|
||||
from backend.main import _render_markdown
|
||||
from backend.render import _render_markdown # ROADMAP #85 T9 — déménagé depuis backend.main
|
||||
result = _render_markdown("![[image.png]]", "TestVault")
|
||||
assert "img" in result or "image" in result or "wikilink" in result
|
||||
|
||||
@@ -709,31 +709,31 @@ class TestCheckVaultWritable:
|
||||
|
||||
class TestConvertWikilinks:
|
||||
def test_convert_wikilink(self):
|
||||
from backend.main import _convert_wikilinks
|
||||
from backend.render import _convert_wikilinks # ROADMAP #85 T9 — déménagé depuis backend.main
|
||||
# Missing wikilinks render as span.wikilink-missing
|
||||
result = _convert_wikilinks("See [[Introduction à Python]] for details", "TestVault")
|
||||
assert "Introduction" in result
|
||||
assert "wikilink" in result
|
||||
|
||||
def test_convert_wikilink_with_alias(self):
|
||||
from backend.main import _convert_wikilinks
|
||||
from backend.render import _convert_wikilinks # ROADMAP #85 T9 — déménagé depuis backend.main
|
||||
result = _convert_wikilinks("See [[file.md|a different name]] here", "TestVault")
|
||||
assert "a different name" in result
|
||||
|
||||
def test_convert_wikilink_image(self):
|
||||
from backend.main import _convert_wikilinks
|
||||
from backend.render import _convert_wikilinks # ROADMAP #85 T9 — déménagé depuis backend.main
|
||||
result = _convert_wikilinks("See ![[image.png]] here", "TestVault")
|
||||
assert "image" in result or "img" in result
|
||||
|
||||
def test_convert_wikilink_anchor(self):
|
||||
from backend.main import _convert_wikilinks
|
||||
from backend.render import _convert_wikilinks # ROADMAP #85 T9 — déménagé depuis backend.main
|
||||
result = _convert_wikilinks("[[#Section importante|voir section]]", "TestVault")
|
||||
assert 'href="#section-importante"' in result
|
||||
assert "wikilink-anchor" in result
|
||||
assert "voir section" in result
|
||||
|
||||
def test_convert_wikilink_anchor_without_alias(self):
|
||||
from backend.main import _convert_wikilinks
|
||||
from backend.render import _convert_wikilinks # ROADMAP #85 T9 — déménagé depuis backend.main
|
||||
result = _convert_wikilinks("[[#Claude Code]]", "TestVault")
|
||||
assert 'href="#claude-code"' in result
|
||||
assert "Claude Code" in result
|
||||
@@ -741,7 +741,7 @@ class TestConvertWikilinks:
|
||||
|
||||
class TestHeadingSlugifyHtmlStripping:
|
||||
def test_slugify_strips_html_tags(self):
|
||||
from backend.main import _heading_slugify
|
||||
from backend.render import _heading_slugify # ROADMAP #85 T9 — déménagé depuis backend.main
|
||||
result = _heading_slugify('## 1. Agents installés localement <a href="#table-des-matieres">↩</a>')
|
||||
assert result == "1-agents-installes-localement"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user