Skip to content

Commit 9d1d169

Browse files
committed
Add tests
1 parent c998a0e commit 9d1d169

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

docs/source/testing/external-links.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
title: External Links
33
---
44

5+
[Elasticsearch](elasticsearch://index.md)
6+
57
[Kibana][1]
68

7-
[1] kibana://index.md
9+
[1]: kibana://index.md

tests/Elastic.Markdown.Tests/Inline/InlineLinkTests.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ public class ExternalLinkReferenceTest(ITestOutputHelper output) : LinkTestBase(
115115
public void GeneratesHtml() =>
116116
// language=html
117117
Html.Should().Contain(
118+
// TODO: The link is not rendered correctly yet, will be fixed in a follow-up
118119
"""<p><a href="kibana://index.html">test</a></p>"""
119120
);
120121

@@ -139,6 +140,7 @@ public class ExternalLinkTest(ITestOutputHelper output) : LinkTestBase(output,
139140
public void GeneratesHtml() =>
140141
// language=html
141142
Html.Should().Contain(
143+
// TODO: The link is not rendered correctly yet, will be fixed in a follow-up
142144
"""<p><a href="kibana://index.html">test</a></p>"""
143145
);
144146

@@ -153,4 +155,35 @@ public void EmitsExternalLink()
153155
}
154156
}
155157

158+
public class DuplicateExternalLinkTest(ITestOutputHelper output) : LinkTestBase(output,
159+
"""
160+
[a](kibana://index.md)
161+
[b](kibana://index.md)
162+
[c](elasticsearch://index.md)
163+
"""
164+
)
165+
{
166+
[Fact]
167+
public void GeneratesHtml() =>
168+
// language=html
169+
Html.Should().Contain(
170+
// TODO: The link is not rendered correctly yet, will be fixed in a follow-up
171+
"""
172+
<p><a href="kibana://index.html">a</a><br />
173+
<a href="kibana://index.html">b</a><br />
174+
<a href="elasticsearch://index.html">c</a></p>
175+
"""
176+
);
177+
178+
[Fact]
179+
public void HasNoErrors() => Collector.Diagnostics.Should().HaveCount(0);
180+
181+
[Fact]
182+
public void EmitsExternalLink()
183+
{
184+
Collector.ExternalLinks.Should().HaveCount(2);
185+
Collector.ExternalLinks.Should().ContainKey("kibana://index.md");
186+
Collector.ExternalLinks.Should().ContainKey("elasticsearch://index.md");
187+
}
188+
}
156189

0 commit comments

Comments
 (0)