File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ limitations under the License.
15
15
package workflow
16
16
17
17
import (
18
+ "errors"
18
19
"testing"
19
20
20
21
daprClient "github.com/dapr/go-sdk/client"
@@ -94,13 +95,24 @@ func TestWorkerOptions(t *testing.T) {
94
95
}
95
96
96
97
func TestRegisterOptions (t * testing.T ) {
97
- t .Run ("with name " , func (t * testing.T ) {
98
+ t .Run ("WithName " , func (t * testing.T ) {
98
99
defaultOpts := registerOptions {}
99
100
options , err := processRegisterOptions (defaultOpts , WithName ("testWorkflow" ))
100
101
require .NoError (t , err )
101
102
assert .NotEmpty (t , options .Name )
102
103
assert .Equal (t , "testWorkflow" , options .Name )
103
104
})
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
+ })
104
116
}
105
117
106
118
func returnWorkerOptions (opts ... workerOption ) workerOptions {
You can’t perform that action at this time.
0 commit comments