Skip to content

Commit ad5bb79

Browse files
dkattanCopilot
andcommitted
fix: make ToFacetsAsync cancellation test deterministic
Cancel token immediately instead of after 5ms to eliminate race condition on fast CI runners where mapping completes before cancellation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c9e8e88 commit ad5bb79

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

test/Facet.Tests/UnitTests/Extensions/Mapping/AsyncMappingTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public async Task ToFacetsAsync_ShouldHandleCancellation()
114114
TestDataFactory.CreateUser("Test2", "User2")
115115
};
116116
var cts = new CancellationTokenSource();
117-
cts.CancelAfter(TimeSpan.FromMilliseconds(5));
117+
cts.Cancel();
118118

119119
var act = () => users.ToFacetsAsync<UserDto, UserDtoAsyncMapper>(cts.Token);
120120
await act.Should().ThrowAsync<OperationCanceledException>();

0 commit comments

Comments
 (0)