|
4 | 4 |
|
5 | 5 | using System.IO.Abstractions.TestingHelpers; |
6 | 6 | using Elastic.Markdown.Diagnostics; |
| 7 | +using Elastic.Markdown.IO; |
7 | 8 | using Elastic.Markdown.Myst.Directives; |
8 | 9 | using Elastic.Markdown.Tests.Directives; |
9 | 10 | using FluentAssertions; |
|
12 | 13 | namespace Elastic.Markdown.Tests.SettingsInclusion; |
13 | 14 |
|
14 | 15 | public class IncludeTests(ITestOutputHelper output) : DirectiveTest<SettingsBlock>(output, |
15 | | -""" |
16 | | -```{settings} _snippets/test.md |
| 16 | +$$""" |
| 17 | +```{settings} /{{SettingsPath.Replace("docs/source/", "")}} |
17 | 18 | ``` |
18 | 19 | """ |
19 | 20 | ) |
20 | 21 | { |
| 22 | + private static readonly string SettingsPath = |
| 23 | + "docs/source/elastic/reference/kibana-alerting-action-settings.yml"; |
| 24 | + |
21 | 25 | protected override void AddToFileSystem(MockFileSystem fileSystem) |
22 | 26 | { |
| 27 | + var realSettingsPath = Path.Combine(Paths.Root.FullName, SettingsPath); |
23 | 28 | // language=markdown |
24 | | - var inclusion = "*Hello world*"; |
25 | | - fileSystem.AddFile(@"docs/source/_snippets/test.md", inclusion); |
| 29 | + var inclusion = System.IO.File.ReadAllText(realSettingsPath); |
| 30 | + fileSystem.AddFile(SettingsPath, inclusion); |
26 | 31 | } |
27 | 32 |
|
28 | 33 | [Fact] |
29 | 34 | public void ParsesBlock() => Block.Should().NotBeNull(); |
30 | 35 |
|
| 36 | + [Fact] |
| 37 | + public void HasNoErrors() => Collector.Diagnostics.Should().BeEmpty(); |
| 38 | + |
31 | 39 | [Fact] |
32 | 40 | public void IncludesInclusionHtml() => |
33 | 41 | Html.Should() |
34 | | - .Contain("Hello world") |
35 | | - .And.Be("<p><em>Hello world</em></p>\n") |
36 | | - ; |
| 42 | + .Contain("xpack.encryptedSavedObjects.encryptionKey"); |
37 | 43 | } |
38 | 44 | public class RandomFileEmitsAnError(ITestOutputHelper output) : DirectiveTest<SettingsBlock>(output, |
39 | 45 | """ |
|
0 commit comments