Skip to content

Commit

Permalink
Newline test fix for non-Windows platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
daveaglick committed Dec 29, 2022
1 parent 65dfc6d commit 55cf376
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ namespace Statiq.Web.Hosting.Tests.Middleware
[TestFixture]
public class ScriptInjectionMiddlewareTests
{
[TestCase("BasicHtmlDocument.html", "<script type=\"text/javascript\" src=\"/livereload.js\"></script></body>", 151)]
[TestCase("BasicHtmlDocumentNoBody.html", "<script type=\"text/javascript\" src=\"/livereload.js\"></script></html>", 146)]
[TestCase("BasicHtmlDocumentNoHtml.html", "<script type=\"text/javascript\" src=\"/livereload.js\"></script>", 89)]
[TestCase("BasicHtmlDocument.html", "<script type=\"text/javascript\" src=\"/livereload.js\"></script></body>", 133)]
[TestCase("BasicHtmlDocumentNoBody.html", "<script type=\"text/javascript\" src=\"/livereload.js\"></script></html>", 130)]
[TestCase("BasicHtmlDocumentNoHtml.html", "<script type=\"text/javascript\" src=\"/livereload.js\"></script>", 77)]
public async Task ShouldInjectScriptAtCorrectLocation(string filename, string injected, int injectionPosition)
{
// Given
Expand All @@ -29,7 +29,7 @@ public async Task ShouldInjectScriptAtCorrectLocation(string filename, string in

// Then
response.StatusCode.ShouldBe(System.Net.HttpStatusCode.OK);
body.LastIndexOf(injected).ShouldBe(injectionPosition);
body.Replace("\r", string.Empty).Replace("\n", string.Empty).LastIndexOf(injected).ShouldBe(injectionPosition);
}

[Test]
Expand Down

0 comments on commit 55cf376

Please sign in to comment.