2020-12-20 08:36:11 +01:00
|
|
|
// Copyright (c) Umbraco.
|
|
|
|
|
// See LICENSE for more details.
|
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
2021-01-13 12:48:41 +11:00
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Moq;
|
2016-02-17 10:59:48 +01:00
|
|
|
using NUnit.Framework;
|
2021-02-09 10:22:42 +01:00
|
|
|
using Umbraco.Cms.Core;
|
|
|
|
|
using Umbraco.Cms.Core.Events;
|
2016-02-17 13:28:11 +01:00
|
|
|
using Umbraco.Core;
|
2021-01-13 12:48:41 +11:00
|
|
|
using Umbraco.Core.Events;
|
2020-04-02 21:19:42 +11:00
|
|
|
using Umbraco.Web.WebAssets;
|
2016-02-17 10:59:48 +01:00
|
|
|
|
2020-10-26 13:34:08 +01:00
|
|
|
namespace Umbraco.Tests.UnitTests.Umbraco.Web.Common.AngularIntegration
|
2016-02-17 10:59:48 +01:00
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public class ServerVariablesParserTests
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
2021-01-13 12:48:41 +11:00
|
|
|
public async Task Parse()
|
2016-02-17 10:59:48 +01:00
|
|
|
{
|
2021-01-13 12:48:41 +11:00
|
|
|
var parser = new ServerVariablesParser(Mock.Of<IEventAggregator>());
|
|
|
|
|
|
2020-12-20 08:36:11 +01:00
|
|
|
var d = new Dictionary<string, object>
|
|
|
|
|
{
|
|
|
|
|
{ "test1", "Test 1" },
|
|
|
|
|
{ "test2", "Test 2" },
|
|
|
|
|
{ "test3", "Test 3" },
|
|
|
|
|
{ "test4", "Test 4" },
|
|
|
|
|
{ "test5", "Test 5" }
|
|
|
|
|
};
|
2016-02-17 10:59:48 +01:00
|
|
|
|
2021-01-13 12:48:41 +11:00
|
|
|
var output = (await parser.ParseAsync(d)).StripWhitespace();
|
2016-02-17 10:59:48 +01:00
|
|
|
|
|
|
|
|
Assert.IsTrue(output.Contains(@"Umbraco.Sys.ServerVariables = {
|
|
|
|
|
""test1"": ""Test 1"",
|
|
|
|
|
""test2"": ""Test 2"",
|
|
|
|
|
""test3"": ""Test 3"",
|
|
|
|
|
""test4"": ""Test 4"",
|
|
|
|
|
""test5"": ""Test 5""
|
2016-02-17 13:28:11 +01:00
|
|
|
} ;".StripWhitespace()));
|
2016-02-17 10:59:48 +01:00
|
|
|
}
|
|
|
|
|
}
|
2017-07-20 11:21:28 +02:00
|
|
|
}
|