package usecase import ( "context" "errors" "testing" "time" "go.maximumdirect.net/promptkit/internal/domain" ) func TestPreparedNotificationChecksContextBeforeInvocation(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) cancel() called := false _, err := (&Runner{}).executePreparedRun(ctx, &domain.PreparedRun{}, func(context.Context, *domain.PreparedRun) { called = true }, false, nil, "", 0, "", time.Time{}, nil) if called || !errors.Is(err, context.Canceled) || !errors.Is(err, ErrLLMGenerate) { t.Fatalf("called=%v error=%v", called, err) } }