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.
1515package workflow
1616
1717import (
18+ "errors"
1819 "testing"
1920
2021 daprClient "github.com/dapr/go-sdk/client"
@@ -94,13 +95,24 @@ func TestWorkerOptions(t *testing.T) {
9495}
9596
9697func 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
106118func returnWorkerOptions (opts ... workerOption ) workerOptions {
You can’t perform that action at this time.
0 commit comments