Skip to content

Commit

Permalink
Merge pull request #39 from wlsnmrk/test-eol-fix
Browse files Browse the repository at this point in the history
test: fix serialization tests on Windows
  • Loading branch information
jolexxa committed Jun 20, 2024
2 parents 9b195d6 + cff68ff commit d6cedf2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace Chickensoft.LogicBlocks.Tests.Serialization;

using System.Text.Json;
using System.Text.Json.Nodes;
using Chickensoft.Collections;
using Chickensoft.Introspection;
using Chickensoft.LogicBlocks.Tests.Fixtures;
Expand Down Expand Up @@ -31,10 +32,10 @@ public void SerializesLogicBlock() {

var options = CreateOptions();

var json = JsonSerializer.Serialize(logic, options);
var jsonText = JsonSerializer.Serialize(logic, options);
var jsonNode = JsonNode.Parse(jsonText);

json.ShouldBe(
/*lang=json,strict*/
var jsonExpectedText = /*lang=json,strict*/
"""
{
"$type": "serializable_logic_block",
Expand All @@ -60,8 +61,9 @@ public void SerializesLogicBlock() {
}
}
}
"""
);
""";
var jsonExpectedNode = JsonNode.Parse(jsonExpectedText);
JsonNode.DeepEquals(jsonNode, jsonExpectedNode).ShouldBeTrue();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace Chickensoft.LogicBlocks.Tutorial.Tests;

using System.Text.Json;
using System.Text.Json.Nodes;
using Chickensoft.Serialization;
using Shouldly;
using Xunit;
Expand All @@ -19,10 +20,10 @@ public void Serializes() {

var logic = new SerializableLogicBlock();

var json = JsonSerializer.Serialize(logic, options);
var jsonText = JsonSerializer.Serialize(logic, options);
var jsonNode = JsonNode.Parse(jsonText);

json.ShouldBe(
/*language=json*/
var jsonExpectedText = /*language=json*/
"""
{
"$type": "serializable_logic",
Expand All @@ -37,8 +38,10 @@ public void Serializes() {
"values": {}
}
}
"""
);
""";
var jsonExpectedNode = JsonNode.Parse(jsonExpectedText);

JsonNode.DeepEquals(jsonNode, jsonExpectedNode).ShouldBeTrue();
}

[Fact]
Expand Down

0 comments on commit d6cedf2

Please sign in to comment.