Skip to content

Commit

Permalink
Fix automated test for Elm format service
Browse files Browse the repository at this point in the history
Do not test differences in line-breaks: Add normalization of line-breaks before applying expectations.
  • Loading branch information
Viir committed Aug 14, 2020
1 parent 67a059c commit 6f408be
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ namespace Kalmit.PersistentProcess.Test
[TestClass]
public class TestElmEditor
{
static string NormalizeStringTestingElmFormat(string originalString) =>
originalString?.Trim()?.Replace("\n\r", "\n")?.Replace("\r\n", "\n");

[TestMethod]
public void Elm_editor_backend_support_format_elm_module_text()
{
Expand Down Expand Up @@ -78,10 +81,10 @@ module Common exposing (..)
"responseStructure.ErrorResponse should be null.\n" + responseStructure.ErrorResponse);

Assert.AreEqual(
expectedElmModuleTextAfterFormatting?.Trim(),
responseStructure
?.FormatElmModuleTextResponse?.FirstOrDefault()
?.formattedText.Just?.FirstOrDefault()?.Trim(),
NormalizeStringTestingElmFormat(expectedElmModuleTextAfterFormatting),
NormalizeStringTestingElmFormat(responseStructure
?.FormatElmModuleTextResponse?.FirstOrDefault()
?.formattedText.Just?.FirstOrDefault()),
"Response content");
}
}
Expand Down

0 comments on commit 6f408be

Please sign in to comment.