mocks

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RunnableRepoMock

type RunnableRepoMock struct {
	// DBFunc mocks the DB method.
	DBFunc func() *sqlx.DB

	// SampleFunc mocks the Sample method.
	SampleFunc func() repos.SampleRepo

	// StartFunc mocks the Start method.
	StartFunc func() error

	// StopFunc mocks the Stop method.
	StopFunc func() error
	// contains filtered or unexported fields
}

RunnableRepoMock is a mock implementation of repos.RunnableRepo.

func TestSomethingThatUsesRunnableRepo(t *testing.T) {

	// make and configure a mocked repos.RunnableRepo
	mockedRunnableRepo := &RunnableRepoMock{
		DBFunc: func() *sqlx.DB {
			panic("mock out the DB method")
		},
		SampleFunc: func() repos.SampleRepo {
			panic("mock out the Sample method")
		},
		StartFunc: func() error {
			panic("mock out the Start method")
		},
		StopFunc: func() error {
			panic("mock out the Stop method")
		},
	}

	// use mockedRunnableRepo in code that requires repos.RunnableRepo
	// and then make assertions.

}

func (*RunnableRepoMock) DB

func (mock *RunnableRepoMock) DB() *sqlx.DB

DB calls DBFunc.

func (*RunnableRepoMock) DBCalls

func (mock *RunnableRepoMock) DBCalls() []struct {
}

DBCalls gets all the calls that were made to DB. Check the length with:

len(mockedRunnableRepo.DBCalls())

func (*RunnableRepoMock) Sample

func (mock *RunnableRepoMock) Sample() repos.SampleRepo

Sample calls SampleFunc.

func (*RunnableRepoMock) SampleCalls

func (mock *RunnableRepoMock) SampleCalls() []struct {
}

SampleCalls gets all the calls that were made to Sample. Check the length with:

len(mockedRunnableRepo.SampleCalls())

func (*RunnableRepoMock) Start

func (mock *RunnableRepoMock) Start() error

Start calls StartFunc.

func (*RunnableRepoMock) StartCalls

func (mock *RunnableRepoMock) StartCalls() []struct {
}

StartCalls gets all the calls that were made to Start. Check the length with:

len(mockedRunnableRepo.StartCalls())

func (*RunnableRepoMock) Stop

func (mock *RunnableRepoMock) Stop() error

Stop calls StopFunc.

func (*RunnableRepoMock) StopCalls

func (mock *RunnableRepoMock) StopCalls() []struct {
}

StopCalls gets all the calls that were made to Stop. Check the length with:

len(mockedRunnableRepo.StopCalls())

Jump to

Keyboard shortcuts

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