registry

package
v1.9.0-capdev.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2026 License: MIT Imports: 5 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capability

type Capability interface {
	Invoke(ctx context.Context, request *sdk.CapabilityRequest) *sdk.CapabilityResponse
	ID() string
}

Capability is meant to be implemented by generated code for capability mocks.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry is meant to be used with GetRegistry, do not use it directly.

func GetRegistry

func GetRegistry(tb testing.TB) *Registry

GetRegistry returns a Registry instance scoped to the provided testing.TB, creating one if it doesn't exist. The registry is used internally by the test utilities to manage mock capabilities.

func (*Registry) ForceRegisterCapability

func (r *Registry) ForceRegisterCapability(c Capability)

ForceRegisterCapability is like RegisterCapability but it overwrites any existing capability with the same ID.

func (*Registry) GetCapability

func (r *Registry) GetCapability(id string) (Capability, error)

GetCapability is meant to be used by generated code to retrieve a registered capability. It retrieves a registered capability by its ID. It returns an error if no capability with the given ID is found.

func (*Registry) RegisterCapability

func (r *Registry) RegisterCapability(c Capability) error

RegisterCapability is meant to be called by generated mock code to register the mock with the test. It returns an error if a capability with the same ID is already registered.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL