File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
GraphQLParser.Tests/Visitors Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -33,12 +33,13 @@ public void ASTVisitor_Should_Throw_On_Unknown_Node()
3333 }
3434
3535 [ Fact ]
36- public void ASTVisitor_Should_Respect_CancellationToken ( )
36+ public void ASTVisitor_Should_Pass_CancellationToken ( )
3737 {
3838 var document = "scalar JSON" . Parse ( ) ;
3939 var visitor = new MyVisitor ( ) ;
4040 using var cts = new CancellationTokenSource ( 500 ) ;
4141 var context = new Context { CancellationToken = cts . Token } ;
42+ context . CancellationToken . ThrowIfCancellationRequested ( ) ;
4243
4344 Should . Throw < OperationCanceledException > ( ( ) => visitor . VisitAsync ( document , context ) . GetAwaiter ( ) . GetResult ( ) ) ;
4445 }
@@ -48,6 +49,7 @@ private class MyVisitor : ASTVisitor<Context>
4849 protected override async ValueTask VisitScalarTypeDefinitionAsync ( GraphQLScalarTypeDefinition scalarTypeDefinition , Context context )
4950 {
5051 await Task . Delay ( 700 ) ;
52+ context . CancellationToken . ThrowIfCancellationRequested ( ) ;
5153 await base . VisitScalarTypeDefinitionAsync ( scalarTypeDefinition , context ) ;
5254 }
5355 }
Original file line number Diff line number Diff line change @@ -595,8 +595,6 @@ protected virtual async ValueTask VisitInputObjectTypeExtensionAsync(GraphQLInpu
595595 /// <param name="context">Context passed into all INodeVisitor.VisitXXX methods.</param>
596596 public virtual ValueTask VisitAsync ( ASTNode ? node , TContext context )
597597 {
598- context . CancellationToken . ThrowIfCancellationRequested ( ) ;
599-
600598 return node == null
601599 ? default
602600 : node switch
You can’t perform that action at this time.
0 commit comments