mocks

package
v0.0.0-...-bdb2e15 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlueprintInjectorMapMock

type BlueprintInjectorMapMock struct {
	// GetFunc mocks the Get method.
	GetFunc func(ctx *cue.Context, name string, attrType injector.AttrType) (cue.Value, error)
	// contains filtered or unexported fields
}

BlueprintInjectorMapMock is a mock implementation of injector.BlueprintInjectorMap.

func TestSomethingThatUsesBlueprintInjectorMap(t *testing.T) {

	// make and configure a mocked injector.BlueprintInjectorMap
	mockedBlueprintInjectorMap := &BlueprintInjectorMapMock{
		GetFunc: func(ctx *cue.Context, name string, attrType injector.AttrType) (cue.Value, error) {
			panic("mock out the Get method")
		},
	}

	// use mockedBlueprintInjectorMap in code that requires injector.BlueprintInjectorMap
	// and then make assertions.

}

func (*BlueprintInjectorMapMock) Get

func (mock *BlueprintInjectorMapMock) Get(ctx *cue.Context, name string, attrType injector.AttrType) (cue.Value, error)

Get calls GetFunc.

func (*BlueprintInjectorMapMock) GetCalls

func (mock *BlueprintInjectorMapMock) GetCalls() []struct {
	Ctx      *cue.Context
	Name     string
	AttrType injector.AttrType
}

GetCalls gets all the calls that were made to Get. Check the length with:

len(mockedBlueprintInjectorMap.GetCalls())

type BlueprintInjectorMock

type BlueprintInjectorMock struct {
	// InjectFunc mocks the Inject method.
	InjectFunc func(bp blueprint.RawBlueprint) blueprint.RawBlueprint
	// contains filtered or unexported fields
}

BlueprintInjectorMock is a mock implementation of injector.BlueprintInjector.

func TestSomethingThatUsesBlueprintInjector(t *testing.T) {

	// make and configure a mocked injector.BlueprintInjector
	mockedBlueprintInjector := &BlueprintInjectorMock{
		InjectFunc: func(bp blueprint.RawBlueprint) blueprint.RawBlueprint {
			panic("mock out the Inject method")
		},
	}

	// use mockedBlueprintInjector in code that requires injector.BlueprintInjector
	// and then make assertions.

}

func (*BlueprintInjectorMock) Inject

Inject calls InjectFunc.

func (*BlueprintInjectorMock) InjectCalls

func (mock *BlueprintInjectorMock) InjectCalls() []struct {
	Bp blueprint.RawBlueprint
}

InjectCalls gets all the calls that were made to Inject. Check the length with:

len(mockedBlueprintInjector.InjectCalls())

Jump to

Keyboard shortcuts

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