@@ -78,31 +78,31 @@ func TestGetBiblePassage(t *testing.T) {
7878func TestParsePassageFromHtml (t * testing.T ) {
7979 t .Run ("Valid HTML with superscript" , func (t * testing.T ) {
8080 html := `<p><span><sup>12 </sup>But to all who did receive him, who believed in his name, he gave the right to become children of God,</span></p>`
81- expected := `^12^ But to all who did receive him, who believed in his name, he gave the right to become children of God,`
81+ expected := `¹² But to all who did receive him, who believed in his name, he gave the right to become children of God,`
8282 if got := ParsePassageFromHtml (html ); got != expected {
8383 t .Errorf ("ParsePassageFromHtml() = %v, want %v" , got , expected )
8484 }
8585 })
8686
8787 t .Run ("HTML with italics" , func (t * testing.T ) {
8888 html := `<p><i>This is italic.</i></p>`
89- expected := `_This is italic\ ._`
89+ expected := `_This is italic._`
9090 if got := ParsePassageFromHtml (html ); got != expected {
9191 t .Errorf ("ParsePassageFromHtml() = %v, want %v" , got , expected )
9292 }
9393 })
9494
9595 t .Run ("HTML with bold" , func (t * testing.T ) {
9696 html := `<p><b>This is bold.</b></p>`
97- expected := `*This is bold\ .*`
97+ expected := `*This is bold.*`
9898 if got := ParsePassageFromHtml (html ); got != expected {
9999 t .Errorf ("ParsePassageFromHtml() = %v, want %v" , got , expected )
100100 }
101101 })
102102
103103 t .Run ("HTML with line breaks" , func (t * testing.T ) {
104104 html := `<p>Line 1.<br>Line 2.</p>`
105- expected := "Line 1\\ .\n Line 2\\ ."
105+ expected := "Line 1.\n Line 2."
106106 if got := ParsePassageFromHtml (html ); got != expected {
107107 t .Errorf ("ParsePassageFromHtml() = %v, want %v" , got , expected )
108108 }
@@ -118,31 +118,35 @@ func TestParsePassageFromHtml(t *testing.T) {
118118
119119 t .Run ("Nested HTML tags" , func (t * testing.T ) {
120120 html := `<p><b>This is bold, <i>and this is italic.</i></b></p>`
121- expected := `*This is bold, *_and this is italic\ ._`
121+ expected := `*This is bold, *_and this is italic._`
122122 if got := ParsePassageFromHtml (html ); got != expected {
123123 t .Errorf ("ParsePassageFromHtml() = %v, want %v" , got , expected )
124124 }
125125 })
126126
127127 t .Run ("MarkdownV2 escaping" , func (t * testing.T ) {
128+ // Note: We no longer escape explicitly in ParsePassageFromHtml as we rely on the platform
129+ // to handle it later (via PostTelegram).
130+ // However, returning raw characters like * might cause issues if not handled by platform.
131+ // For now, we expect them to be returned raw.
128132 html := `<p>This has special characters: *_. [hello](world)!</p>`
129- expected := `This has special characters: \*\_\. \ [hello\]\ (world\)\ !`
133+ expected := `This has special characters: *_. [hello] (world) !`
130134 if got := ParsePassageFromHtml (html ); got != expected {
131135 t .Errorf ("ParsePassageFromHtml() = %v, want %v" , got , expected )
132136 }
133137 })
134138
135139 t .Run ("Backslash escaping" , func (t * testing.T ) {
136140 html := `added to you\.`
137- expected := `added to you\\\ .`
141+ expected := `added to you\.`
138142 if got := ParsePassageFromHtml (html ); got != expected {
139143 t .Errorf ("ParsePassageFromHtml() = %v, want %v" , got , expected )
140144 }
141145 })
142146
143147 t .Run ("Dot escaping" , func (t * testing.T ) {
144148 html := `heaven.`
145- expected := `heaven\ .`
149+ expected := `heaven.`
146150 if got := ParsePassageFromHtml (html ); got != expected {
147151 t .Errorf ("ParsePassageFromHtml() = %v, want %v" , got , expected )
148152 }
0 commit comments