"""Tests for HTML exporter."""

from __future__ import annotations

from noteflow.domain.entities import ActionItem, KeyPoint, Meeting, Segment, Summary
from noteflow.infrastructure.export.html import HtmlExporter


class TestHtmlExporter:
    """Tests for HtmlExporter output."""

    def test_export_escapes_html(self) -> None:
        meeting = Meeting.create(title="<Weekly & Sync>")
        segments = [
            Segment(segment_id=0, text="Hello <team>", start_time=0.0, end_time=1.0),
        ]
        summary = Summary(
            meeting_id=meeting.id,
            executive_summary="Summary with <b>bold</b>",
            key_points=[KeyPoint(text="Key <point>")],
            action_items=[ActionItem(text="Do <thing>", assignee="bob<")],
        )
        meeting.summary = summary

        exporter = HtmlExporter()
        output = exporter.export(meeting, segments)

        assert "&lt;Weekly &amp; Sync&gt;" in output, "Title HTML entities should be escaped"
        assert "Hello &lt;team&gt;" in output, "Segment text HTML entities should be escaped"
        assert "Summary with &lt;b&gt;bold&lt;/b&gt;" in output, "Summary HTML entities should be escaped"
        assert "Key &lt;point&gt;" in output, "Key point HTML entities should be escaped"
        assert "@bob&lt;" in output, "Assignee HTML entities should be escaped"
