Skip to content

Commit bdcfb10

Browse files
authored
[browser] Fix passing parameter to test added in #108190 (#108199)
1 parent 080fcae commit bdcfb10

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SatelliteLoadingTests.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,24 @@ public async Task LoadSatelliteAssembly(bool loadAllSatelliteResources)
3535
var result = await RunSdkStyleAppForBuild(new(
3636
Configuration: "Debug",
3737
TestScenario: "SatelliteAssembliesTest",
38-
BrowserQueryString: new Dictionary<string, string> { ["loadAllSatelliteResources"] = loadAllSatelliteResources.ToString() }
38+
BrowserQueryString: new Dictionary<string, string> { ["loadAllSatelliteResources"] = loadAllSatelliteResources.ToString().ToLowerInvariant() }
3939
));
40+
41+
var expectedOutput = new List<Action<string>>();
42+
if (!loadAllSatelliteResources)
43+
{
44+
// If we are loading all satellite, we don't have a way to test resources without satellite assemblies being loaded.
45+
// So there messages are should be present only when we are lazily loading satellites.
46+
expectedOutput.Add(m => Assert.Equal("default: hello", m));
47+
expectedOutput.Add(m => Assert.Equal("es-ES without satellite: hello", m));
48+
}
49+
50+
expectedOutput.Add(m => Assert.Equal("default: hello", m));
51+
expectedOutput.Add(m => Assert.Equal("es-ES with satellite: hola", m));
52+
4053
Assert.Collection(
4154
result.TestOutput,
42-
m => Assert.Equal("default: hello", m),
43-
m => Assert.Equal("es-ES without satellite: hello", m),
44-
m => Assert.Equal("default: hello", m),
45-
m => Assert.Equal("es-ES with satellite: hola", m)
55+
expectedOutput.ToArray()
4656
);
4757
}
4858

src/mono/wasm/testassets/WasmBasicTestApp/App/SatelliteAssembliesTest.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ public partial class SatelliteAssembliesTest
1010
[JSExport]
1111
public static async Task Run(bool loadSatelliteAssemblies)
1212
{
13-
ResourceLibrary.ResourceAccessor.Read(TestOutput.WriteLine, false);
14-
1513
if (loadSatelliteAssemblies)
14+
{
15+
ResourceLibrary.ResourceAccessor.Read(TestOutput.WriteLine, false);
1616
await LoadSatelliteAssemblies(new[] { "es-ES" });
17+
}
1718

1819
ResourceLibrary.ResourceAccessor.Read(TestOutput.WriteLine, true);
1920
}

0 commit comments

Comments
 (0)