Skip to content

Commit 2cc020a

Browse files
committed
fix unit test to allow for windows paths
1 parent 76936f9 commit 2cc020a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tests/Elastic.Documentation.Configuration.Tests/DocumentationSetFileTests.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// See the LICENSE file in the project root for more information
44

55
using System.IO.Abstractions.TestingHelpers;
6+
using System.Runtime.InteropServices;
67
using Elastic.Documentation.Configuration.DocSet;
78
using Elastic.Documentation.Diagnostics;
89
using FluentAssertions;
@@ -760,22 +761,25 @@ public void LoadAndResolveSetsContextForAllItems()
760761
var collector = new DiagnosticsCollector([]);
761762
var result = DocumentationSetFile.LoadAndResolve(collector, docsetPath, fileSystem);
762763

764+
var docset = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "C:/docs/docset.yml" : "/docs/docset.yml";
765+
var toc = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "C:/docs/development/toc.yml" : "/docs/development/toc.yml";
766+
763767
// All items from docset.yml should have context = /docs/docset.yml
764768
result.TableOfContents.ElementAt(0).Should().BeOfType<IndexFileRef>()
765-
.Which.Context.Should().Be("/docs/docset.yml");
769+
.Which.Context.Should().Be(docset);
766770

767771
var guidesFolder = result.TableOfContents.ElementAt(1).Should().BeOfType<FolderRef>().Subject;
768-
guidesFolder.Context.Should().Be("/docs/docset.yml");
772+
guidesFolder.Context.Should().Be(docset);
769773
guidesFolder.Children.ElementAt(0).Should().BeOfType<FileRef>()
770-
.Which.Context.Should().Be("/docs/docset.yml");
774+
.Which.Context.Should().Be(docset);
771775

772776
// The TOC ref itself has context = /docs/docset.yml (where it was referenced)
773777
var developmentToc = result.TableOfContents.ElementAt(2).Should().BeOfType<IsolatedTableOfContentsRef>().Subject;
774-
developmentToc.Context.Should().Be("/docs/docset.yml");
778+
developmentToc.Context.Should().Be(docset);
775779

776780
// But children of the TOC ref should have context = /docs/development/toc.yml (where they were defined)
777781
developmentToc.Children.ElementAt(0).Should().BeOfType<FileRef>()
778-
.Which.Context.Should().Be("/docs/development/toc.yml");
782+
.Which.Context.Should().Be(toc);
779783
}
780784

781785
[Fact]

0 commit comments

Comments
 (0)