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{ ... }
- func (mock *JobServiceMock) GetJobs(ctx context.Context, limit int, offset int) ([]*domain.Job, int, error)
- func (mock *JobServiceMock) GetJobsCalls() []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)
// GetJobsFunc mocks the GetJobs method.
GetJobsFunc func(ctx context.Context, limit int, offset int) ([]*domain.Job, int, 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")
},
GetJobsFunc: func(ctx context.Context, limit int, offset int) ([]*domain.Job, int, error) {
panic("mock out the GetJobs 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())
func (*JobServiceMock) GetJobs ¶ added in v0.10.0
func (mock *JobServiceMock) GetJobs(ctx context.Context, limit int, offset int) ([]*domain.Job, int, error)
GetJobs calls GetJobsFunc.
func (*JobServiceMock) GetJobsCalls ¶ added in v0.10.0
func (mock *JobServiceMock) GetJobsCalls() []struct { Ctx context.Context Limit int Offset int }
GetJobsCalls gets all the calls that were made to GetJobs. Check the length with:
len(mockedJobService.GetJobsCalls())
Click to show internal directories.
Click to hide internal directories.