MCPcopy Create free account
hub / github.com/codnect/chrono / TestTriggerTask_ScheduleWithError

Function TestTriggerTask_ScheduleWithError

task_test.go:101–114  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

99}
100
101func TestTriggerTask_ScheduleWithError(t *testing.T) {
102 scheduledExecutorMock := &scheduledExecutorMock{}
103
104 scheduledExecutorMock.On("Schedule", mock.AnythingOfType("Task"), mock.AnythingOfType("time.Duration")).
105 Return((*ScheduledRunnableTask)(nil), errors.New("test error"))
106
107 trigger, err := CreateCronTrigger("* * * * * *", time.Local)
108 assert.Nil(t, err)
109
110 task, _ := CreateTriggerTask(func(ctx context.Context) {}, scheduledExecutorMock, trigger)
111 _, err = task.Schedule()
112
113 assert.NotNil(t, err)
114}

Callers

nothing calls this directly

Calls 3

CreateCronTriggerFunction · 0.85
CreateTriggerTaskFunction · 0.85
ScheduleMethod · 0.65

Tested by

no test coverage detected