Notify callers from the prepared execution snapshot

This commit is contained in:
2026-11-14 17:39:17 +00:00
parent 4cc5a55579
commit 79699acbb9
5 changed files with 95 additions and 2 deletions

View File

@@ -0,0 +1,20 @@
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)
}
}