|
1 | 1 | import pytest |
2 | 2 | from io import BytesIO |
| 3 | +from emailer_lib.ingress import mjml_to_intermediate_email |
3 | 4 | from emailer_lib.mjml._core import MJMLTag, TagAttrDict |
4 | 5 |
|
5 | 6 |
|
@@ -89,10 +90,10 @@ def test_render_with_string_and_tag_children(): |
89 | 90 | assert "More text" in mjml_content |
90 | 91 |
|
91 | 92 |
|
92 | | -def test_repr_returns_mjml(): |
| 93 | +def test_repr_returns_simple_string(): |
93 | 94 | tag = MJMLTag("mj-text", content="Hello") |
94 | 95 |
|
95 | | - assert repr(tag) == tag._render_mjml() |
| 96 | + assert repr(tag) == "<MJMLTag(mj-text)>" |
96 | 97 |
|
97 | 98 |
|
98 | 99 | def test_to_html_with_complete_mjml_document(): |
@@ -121,12 +122,14 @@ def test_to_html_warns_and_wraps_other_tags(): |
121 | 122 | assert "html" in html_result |
122 | 123 |
|
123 | 124 |
|
124 | | -def test_repr_html_calls_to_html(): |
| 125 | +def test_repr_html_returns_intermediate_email_repr_html(): |
125 | 126 | tag = MJMLTag("mjml", MJMLTag("mj-body")) |
126 | 127 | html_from_repr = tag._repr_html_() |
127 | | - html_from_method = tag.to_html() |
128 | 128 |
|
129 | | - assert html_from_repr == html_from_method |
| 129 | + # _repr_html_() should return the HTML representation from mjml_to_intermediate_email |
| 130 | + assert "<!doctype html" in html_from_repr.lower() or "<html" in html_from_repr |
| 131 | + assert isinstance(html_from_repr, str) |
| 132 | + assert html_from_repr == mjml_to_intermediate_email(tag)._repr_html_() |
130 | 133 |
|
131 | 134 |
|
132 | 135 | def test_to_html_passes_kwargs_to_mjml2html(): |
|
0 commit comments