package executor

import (
	"context"
	"testing"

	"scheduler-backend/internal/jobdef"
	"scheduler-backend/pkg/log"
)

func TestExecuteRunsRegisteredHandler(t *testing.T) {
	registry := jobdef.NewRegistry(jobdef.SampleHandler{})
	service := NewService(
		registry,
		jobdef.Runtime{
			Logger: log.New(),
		},
	)

	err := service.Execute(context.Background(), "sample-handler", jobdef.ExecuteRequest{
		ExecutionID: "exec-1",
		JobID:       "job-1",
		TriggerType: "manual",
	})
	if err != nil {
		t.Fatalf("Execute() error = %v", err)
	}
}
