@@ -116,28 +116,31 @@ describe("toSanitizedMarkdownHtml", () => {
|
116 | 116 | |
117 | 117 | it("does NOT link www. domains starting with non-ASCII", () => { |
118 | 118 | const html1 = toSanitizedMarkdownHtml("Visit www.ünich.de"); |
119 | | -expect(html1).not.toContain("<a"); |
120 | | -expect(html1).toContain("www.ünich.de"); |
| 119 | +expect(html1).toBe("<p>Visit www.ünich.de</p>\n"); |
121 | 120 | |
122 | 121 | const html2 = toSanitizedMarkdownHtml("Visit www.ñoño.com"); |
123 | | -expect(html2).not.toContain("<a"); |
| 122 | +expect(html2).toBe("<p>Visit www.ñoño.com</p>\n"); |
124 | 123 | }); |
125 | 124 | |
126 | 125 | it("handles balanced parentheses in URLs", () => { |
127 | 126 | const html = toSanitizedMarkdownHtml("(see www.example.com/foo(bar))"); |
128 | | -expect(html).toContain('href="http://www.example.com/foo(bar)"'); |
| 127 | +expect(html).toBe( |
| 128 | +'<p>(see <a href="http://www.example.com/foo(bar)" rel="noreferrer noopener" target="_blank">www.example.com/foo(bar)</a>)</p>\n', |
| 129 | +); |
129 | 130 | }); |
130 | 131 | |
131 | 132 | it("stops at < character", () => { |
132 | 133 | // Stops at < character |
133 | 134 | const html1 = toSanitizedMarkdownHtml("Visit www.example.com/path<test"); |
134 | | -expect(html1).toContain('href="http://www.example.com/path"'); |
135 | | -expect(html1).toContain("<test"); |
| 135 | +expect(html1).toBe( |
| 136 | +'<p>Visit <a href="http://www.example.com/path" rel="noreferrer noopener" target="_blank">www.example.com/path</a><test</p>\n', |
| 137 | +); |
136 | 138 | |
137 | 139 | // <tag> pattern — stops before < |
138 | 140 | const html2 = toSanitizedMarkdownHtml("Visit www.example.com/<token> here"); |
139 | | -expect(html2).toContain('href="http://www.example.com/"'); |
140 | | -expect(html2).toContain("<token>"); |
| 141 | +expect(html2).toBe( |
| 142 | +'<p>Visit <a href="http://www.example.com/" rel="noreferrer noopener" target="_blank">www.example.com/</a><token> here</p>\n', |
| 143 | +); |
141 | 144 | }); |
142 | 145 | |
143 | 146 | it("does NOT link bare domains without www", () => { |
|