From bdcfb10eec930bbe1b577f05f3b5165ef8fd2e05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Wed, 25 Sep 2024 10:20:39 +0200 Subject: [PATCH] [browser] Fix passing parameter to test added in #108190 (#108199) --- .../TestAppScenarios/SatelliteLoadingTests.cs | 20 ++++++++++++++----- .../App/SatelliteAssembliesTest.cs | 5 +++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SatelliteLoadingTests.cs b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SatelliteLoadingTests.cs index b5cd463e17564..4ef606b784e45 100644 --- a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SatelliteLoadingTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SatelliteLoadingTests.cs @@ -35,14 +35,24 @@ public async Task LoadSatelliteAssembly(bool loadAllSatelliteResources) var result = await RunSdkStyleAppForBuild(new( Configuration: "Debug", TestScenario: "SatelliteAssembliesTest", - BrowserQueryString: new Dictionary { ["loadAllSatelliteResources"] = loadAllSatelliteResources.ToString() } + BrowserQueryString: new Dictionary { ["loadAllSatelliteResources"] = loadAllSatelliteResources.ToString().ToLowerInvariant() } )); + + var expectedOutput = new List>(); + if (!loadAllSatelliteResources) + { + // If we are loading all satellite, we don't have a way to test resources without satellite assemblies being loaded. + // So there messages are should be present only when we are lazily loading satellites. + expectedOutput.Add(m => Assert.Equal("default: hello", m)); + expectedOutput.Add(m => Assert.Equal("es-ES without satellite: hello", m)); + } + + expectedOutput.Add(m => Assert.Equal("default: hello", m)); + expectedOutput.Add(m => Assert.Equal("es-ES with satellite: hola", m)); + Assert.Collection( result.TestOutput, - m => Assert.Equal("default: hello", m), - m => Assert.Equal("es-ES without satellite: hello", m), - m => Assert.Equal("default: hello", m), - m => Assert.Equal("es-ES with satellite: hola", m) + expectedOutput.ToArray() ); } diff --git a/src/mono/wasm/testassets/WasmBasicTestApp/App/SatelliteAssembliesTest.cs b/src/mono/wasm/testassets/WasmBasicTestApp/App/SatelliteAssembliesTest.cs index cd4d9e1fe0cb4..8d7631e0c8f6c 100644 --- a/src/mono/wasm/testassets/WasmBasicTestApp/App/SatelliteAssembliesTest.cs +++ b/src/mono/wasm/testassets/WasmBasicTestApp/App/SatelliteAssembliesTest.cs @@ -10,10 +10,11 @@ public partial class SatelliteAssembliesTest [JSExport] public static async Task Run(bool loadSatelliteAssemblies) { - ResourceLibrary.ResourceAccessor.Read(TestOutput.WriteLine, false); - if (loadSatelliteAssemblies) + { + ResourceLibrary.ResourceAccessor.Read(TestOutput.WriteLine, false); await LoadSatelliteAssemblies(new[] { "es-ES" }); + } ResourceLibrary.ResourceAccessor.Read(TestOutput.WriteLine, true); }