package worker

import (
	"context"
	"encoding/json"
	"testing"

	taskbiz "kra/internal/biz/task"
	platformtask "kra/pkg/task"
)

func TestTaskMethodsReportUnavailableDependencies(t *testing.T) {
	registry := platformtask.NewRegistry()
	(&TaskMethods{}).RegisterTasks(registry)

	for _, name := range []string{taskbiz.TaskMethodClearDB, taskbiz.TaskMethodUploads} {
		method, ok := registry.Lookup(name)
		if !ok {
			t.Fatalf("task method %q was not registered", name)
		}
		if err := method(context.Background(), json.RawMessage(`{}`)); err == nil {
			t.Fatalf("task method %q returned nil with missing dependencies", name)
		}
	}
}
