services

package
v0.0.0-...-720dba8 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBrokerTenant string = "default"

Variables

This section is empty.

Functions

This section is empty.

Types

type EntityLocator

type EntityLocator interface {
	Locate(ctx context.Context, entityType, entityID string) (latitude, longitude float64, err error)
}

func NewEntityLocator

func NewEntityLocator(host, tenant string) (EntityLocator, error)

type EntityLocatorMock

type EntityLocatorMock struct {
	// LocateFunc mocks the Locate method.
	LocateFunc func(ctx context.Context, entityType string, entityID string) (float64, float64, error)
	// contains filtered or unexported fields
}

EntityLocatorMock is a mock implementation of EntityLocator.

func TestSomethingThatUsesEntityLocator(t *testing.T) {

	// make and configure a mocked EntityLocator
	mockedEntityLocator := &EntityLocatorMock{
		LocateFunc: func(ctx context.Context, entityType string, entityID string) (float64, float64, error) {
			panic("mock out the Locate method")
		},
	}

	// use mockedEntityLocator in code that requires EntityLocator
	// and then make assertions.

}

func (*EntityLocatorMock) Locate

func (mock *EntityLocatorMock) Locate(ctx context.Context, entityType string, entityID string) (float64, float64, error)

Locate calls LocateFunc.

func (*EntityLocatorMock) LocateCalls

func (mock *EntityLocatorMock) LocateCalls() []struct {
	Ctx        context.Context
	EntityType string
	EntityID   string
}

LocateCalls gets all the calls that were made to Locate. Check the length with:

len(mockedEntityLocator.LocateCalls())

Jump to

Keyboard shortcuts

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