Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions tests/Elastic.Markdown.Tests/Directives/AdmonitionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ A regular paragraph.
"""
)
{
private readonly ITestOutputHelper _output = output;

[Fact]
public void SetsCorrectAdmonitionType() => Block!.Admonition.Should().Be("dropdown");

Expand All @@ -194,8 +196,8 @@ public void ContainsNestedDirective()
{
var html = Html;
// Output the full HTML for inspection
output.WriteLine("Generated HTML:");
output.WriteLine(html);
_output.WriteLine("Generated HTML:");
_output.WriteLine(html);

html.Should().Contain("Nested Note");
html.Should().Contain("This is a nested note with colons: 10:30 AM");
Expand Down
4 changes: 2 additions & 2 deletions tests/authoring/Framework/MarkdownDocumentAssertions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ module MarkdownDocumentAssertions =
let matter = result.File.YamlFrontMatter
match matter with
| NonNull m ->
match expectedAvailability with
| NonNull a -> m.AppliesTo.Diagnostics <- a.Diagnostics
match (expectedAvailability, m.AppliesTo) with
| NonNull a, NonNull applies -> applies.Diagnostics <- a.Diagnostics
| _ -> ()

let apply = m.AppliesTo
Expand Down
26 changes: 19 additions & 7 deletions tests/authoring/FrontMatter/ProductsFrontMatter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,19 @@ This is a test page without products frontmatter.

// Test that the file has the correct products
test <@ defaultFile.File.YamlFrontMatter <> null @>
test <@ defaultFile.File.YamlFrontMatter.Products <> null @>
test <@ defaultFile.File.YamlFrontMatter.Products.Count = 2 @>
match defaultFile.File.YamlFrontMatter with
| NonNull yamlFrontMatter ->
test <@ yamlFrontMatter.Products <> null @>
match yamlFrontMatter.Products with
| NonNull products ->
test <@ products.Count = 2 @>
// Test that the products are correctly identified
let productIds = products |> Seq.map _.Id |> Set.ofSeq
test <@ productIds.Contains("elasticsearch") @>
test <@ productIds.Contains("ecctl") @>
| _ -> ()
| _ -> ()

// Test that the products are correctly identified
let productIds = defaultFile.File.YamlFrontMatter.Products |> Seq.map (fun p -> p.Id) |> Set.ofSeq
test <@ productIds.Contains("elasticsearch") @>
test <@ productIds.Contains("ecctl") @>

[<Fact>]
let ``does not include products in frontmatter when no products are specified`` () =
Expand All @@ -84,4 +90,10 @@ This is a test page without products frontmatter.
let defaultFile = results.MarkdownResults |> Seq.find (fun r -> r.File.RelativePath = "index.md")

// Test that the file has no products
test <@ defaultFile.File.YamlFrontMatter = null || defaultFile.File.YamlFrontMatter.Products = null || defaultFile.File.YamlFrontMatter.Products.Count = 0 @>
match defaultFile.File.YamlFrontMatter with
| NonNull frontMatter ->
match frontMatter.Products with
| NonNull products ->
test <@ products.Count = 0 @>
| _ -> ()
| _ -> ()
Loading