From 1e0c0b29b84afc1b80bbb670adcea9ac96f53287 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sat, 9 Mar 2024 20:24:00 +0100 Subject: [PATCH] WaitDoesNotAssertInAsyncCode --- .../JavaScript/WebWorkerTest.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs index 8c906010c58b8b..84fb6d191bbd36 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs @@ -467,6 +467,29 @@ await executor.Execute(async () => }, cts.Token); } + + [Theory, MemberData(nameof(GetTargetThreadsAndBlockingCalls))] + public async Task WaitDoesNotAssertInAsyncCode(Executor executor, NamedCall method) + { + using var cts = CreateTestCaseTimeoutSource(); + await executor.Execute(async () => + { + await executor.StickyAwait(WebWorkerTestHelper.InitializeAsync(), cts.Token); + + Exception? exception = null; + try + { + method.Call(cts.Token); + } + catch (Exception ex) + { + exception = ex; + } + + Assert.Null(exception); + }, cts.Token); + } + [Theory, MemberData(nameof(GetTargetThreadsAndBlockingCalls))] public async Task WaitAssertsOnSyncCallback(Executor executor, NamedCall method) {