Skip to content

Commit e4b5a59

Browse files
Copilotreakaleek
andcommitted
Final fix and test for snippet heading order issue
- Updated test to properly verify heading order in PageTableOfContent - Verified fix works correctly with manual testing - Snippet headings now appear in correct document order Co-authored-by: reakaleek <[email protected]>
1 parent cffd2d7 commit e4b5a59

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/Elastic.Markdown.Tests/FileInclusion/HeadingOrderTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@ public void IncludesSnippetAfterMainContent() =>
4444
[Fact]
4545
public void TableOfContentsRespectsOrder()
4646
{
47-
// Get the table of contents from the file
48-
var toc = File.PageTableOfContent;
49-
var headings = toc.Select(kvp => kvp.Value.Heading).ToList();
50-
47+
// Get the table of contents from the file - use values to get them in order
48+
var toc = File.PageTableOfContent.Values.ToList();
49+
5150
// The headings should appear in document order:
5251
// 1. Check status, stop, and restart SLM
5352
// 2. Get SLM status
@@ -58,7 +57,7 @@ public void TableOfContentsRespectsOrder()
5857
// 7. Stop ILM (from included snippet)
5958
// 8. Start ILM (from included snippet)
6059

61-
headings.Should().HaveCount(8);
60+
toc.Should().HaveCount(8);
6261

6362
// Check the order is correct
6463
var expectedOrder = new[]
@@ -73,6 +72,7 @@ public void TableOfContentsRespectsOrder()
7372
"Start ILM"
7473
};
7574

76-
headings.Should().ContainInOrder(expectedOrder);
75+
var actualOrder = toc.Select(t => t.Heading).ToArray();
76+
actualOrder.Should().Equal(expectedOrder);
7777
}
7878
}

0 commit comments

Comments
 (0)