Skip to content

Commit e70eefd

Browse files
committed
Add extra test to increase test coverage
1 parent d97e285 commit e70eefd

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

workflow/worker_test.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ limitations under the License.
1515
package workflow
1616

1717
import (
18+
"errors"
1819
"testing"
1920

2021
daprClient "github.com/dapr/go-sdk/client"
@@ -94,13 +95,24 @@ func TestWorkerOptions(t *testing.T) {
9495
}
9596

9697
func TestRegisterOptions(t *testing.T) {
97-
t.Run("with name", func(t *testing.T) {
98+
t.Run("WithName", func(t *testing.T) {
9899
defaultOpts := registerOptions{}
99100
options, err := processRegisterOptions(defaultOpts, WithName("testWorkflow"))
100101
require.NoError(t, err)
101102
assert.NotEmpty(t, options.Name)
102103
assert.Equal(t, "testWorkflow", options.Name)
103104
})
105+
106+
t.Run("error handling", func(t *testing.T) {
107+
optionThatFails := func(opts *registerOptions) error {
108+
return errors.New("this always fails")
109+
}
110+
111+
defaultOpts := registerOptions{}
112+
_, err := processRegisterOptions(defaultOpts, optionThatFails)
113+
require.Error(t, err)
114+
require.ErrorContains(t, err, "this always fails")
115+
})
104116
}
105117

106118
func returnWorkerOptions(opts ...workerOption) workerOptions {

0 commit comments

Comments
 (0)