Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

test(autosolver): avoid empty branch in context cancellation test

Yash Jadhav5952adf38451
diff --git a/internal/autosolver/autosolver_test.go b/internal/autosolver/autosolver_test.go
index eee914f1..64d105d6 100644
--- a/internal/autosolver/autosolver_test.go
+++ b/internal/autosolver/autosolver_test.go
@@ -275,12 +275,16 @@ func TestSolve_ContextCancellation(t *testing.T) {
executor := &mockExecutor{}
result, err := as.Solve(ctx, page, executor)
+ // Depending on timing, Solve may return a context error directly or
+ // terminate with a non-success result after the context is canceled.
if err == nil {
- // Context cancellation may or may not surface as an error
- // depending on timing; the key check is that it terminates.
+ if ctx.Err() == nil {
+ t.Fatalf("expected context cancellation or solve error; got err=nil and ctx.Err()=nil")
+ }
+ } else if ctx.Err() == nil {
+ t.Fatalf("got error %v but context was not canceled", err)
}
_ = result
- _ = err
}
func TestSolve_PriorityOrdering(t *testing.T) {