Files
promptkit/internal/usecase/prepared_notification_test.go

21 lines
588 B
Go

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)
}
}