Documentation
¶
Index ¶
- type JobServiceMock
- func (mock *JobServiceMock) CreateJob(ctx context.Context, jobConfig *domain.JobConfig) (*domain.Job, error)
- func (mock *JobServiceMock) CreateJobCalls() []struct{ ... }
- func (mock *JobServiceMock) GetJob(ctx context.Context, jobID string) (*domain.Job, error)
- func (mock *JobServiceMock) GetJobCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JobServiceMock ¶
type JobServiceMock struct {
// CreateJobFunc mocks the CreateJob method.
CreateJobFunc func(ctx context.Context, jobConfig *domain.JobConfig) (*domain.Job, error)
// GetJobFunc mocks the GetJob method.
GetJobFunc func(ctx context.Context, jobID string) (*domain.Job, error)
// contains filtered or unexported fields
}
JobServiceMock is a mock implementation of application.JobService.
func TestSomethingThatUsesJobService(t *testing.T) {
// make and configure a mocked application.JobService
mockedJobService := &JobServiceMock{
CreateJobFunc: func(ctx context.Context, jobConfig *domain.JobConfig) (*domain.Job, error) {
panic("mock out the CreateJob method")
},
GetJobFunc: func(ctx context.Context, jobID string) (*domain.Job, error) {
panic("mock out the GetJob method")
},
}
// use mockedJobService in code that requires application.JobService
// and then make assertions.
}
func (*JobServiceMock) CreateJob ¶
func (mock *JobServiceMock) CreateJob(ctx context.Context, jobConfig *domain.JobConfig) (*domain.Job, error)
CreateJob calls CreateJobFunc.
func (*JobServiceMock) CreateJobCalls ¶
func (mock *JobServiceMock) CreateJobCalls() []struct { Ctx context.Context JobConfig *domain.JobConfig }
CreateJobCalls gets all the calls that were made to CreateJob. Check the length with:
len(mockedJobService.CreateJobCalls())
func (*JobServiceMock) GetJobCalls ¶
func (mock *JobServiceMock) GetJobCalls() []struct { Ctx context.Context JobID string }
GetJobCalls gets all the calls that were made to GetJob. Check the length with:
len(mockedJobService.GetJobCalls())
Click to show internal directories.
Click to hide internal directories.