mocks

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 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 EventHandlerMock

type EventHandlerMock struct {
	// FiringFunc mocks the Firing method.
	FiringFunc func(p *project.Project, events map[string]cue.Value) bool
	// contains filtered or unexported fields
}

EventHandlerMock is a mock implementation of events.EventHandler.

func TestSomethingThatUsesEventHandler(t *testing.T) {

	// make and configure a mocked events.EventHandler
	mockedEventHandler := &EventHandlerMock{
		FiringFunc: func(p *project.Project, events map[string]cue.Value) bool {
			panic("mock out the Firing method")
		},
	}

	// use mockedEventHandler in code that requires events.EventHandler
	// and then make assertions.

}

func (*EventHandlerMock) Firing

func (mock *EventHandlerMock) Firing(p *project.Project, events map[string]cue.Value) bool

Firing calls FiringFunc.

func (*EventHandlerMock) FiringCalls

func (mock *EventHandlerMock) FiringCalls() []struct {
	P      *project.Project
	Events map[string]cue.Value
}

FiringCalls gets all the calls that were made to Firing. Check the length with:

len(mockedEventHandler.FiringCalls())

Jump to

Keyboard shortcuts

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