From 3ec10f8639f3baacff540faba9c79e60130f80c2 Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Mon, 14 Oct 2019 17:16:29 +0200 Subject: [PATCH] JSON stringify tests. --- .../Operations/HandleRules/RuleEventFormatterTests.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleEventFormatterTests.cs b/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleEventFormatterTests.cs index 6cd20d0f3..74f125be3 100644 --- a/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleEventFormatterTests.cs +++ b/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleEventFormatterTests.cs @@ -375,5 +375,15 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules Assert.Equal("{\"actor\":\"client:android\"}", result); } + + [Fact] + public void Should_format_json_with_special_characters() + { + var @event = new EnrichedContentEvent { Actor = new RefToken(RefTokenType.Client, "mobile\"android") }; + + var result = sut.Format("Script(JSON.stringify({ actor: event.actor.toString() }))", @event); + + Assert.Equal("{\"actor\":\"client:mobile\\\"android\"}", result); + } } }