@@ -648,6 +648,38 @@ func TestAsyncOperationFromWorkflow(t *testing.T) {
648
648
})
649
649
}
650
650
651
+ func TestNewNexusClientValidation (t * testing.T ) {
652
+ ctx , cancel := context .WithTimeout (context .Background (), time .Second * 10 )
653
+ defer cancel ()
654
+ tc := newTestContext (t , ctx )
655
+
656
+ callerWorkflow := func (ctx workflow.Context , endpoint , service string ) (err error ) {
657
+ defer func () {
658
+ panicMessage := recover ()
659
+ err = fmt .Errorf ("recovered: %s" , panicMessage )
660
+ }()
661
+ _ = workflow .NewNexusClient (endpoint , service )
662
+ return
663
+ }
664
+
665
+ w := worker .New (tc .client , tc .taskQueue , worker.Options {})
666
+ w .RegisterWorkflow (callerWorkflow )
667
+ require .NoError (t , w .Start ())
668
+ t .Cleanup (w .Stop )
669
+
670
+ opts := client.StartWorkflowOptions {
671
+ TaskQueue : tc .taskQueue ,
672
+ }
673
+
674
+ run , err := tc .client .ExecuteWorkflow (ctx , opts , callerWorkflow , "" , "service" )
675
+ require .NoError (t , err )
676
+ require .ErrorContains (t , run .Get (ctx , nil ), "recovered: endpoint must not be empty" )
677
+
678
+ run , err = tc .client .ExecuteWorkflow (ctx , opts , callerWorkflow , "endpoint" , "" )
679
+ require .NoError (t , err )
680
+ require .ErrorContains (t , run .Get (ctx , nil ), "recovered: service must not be empty" )
681
+ }
682
+
651
683
func TestReplay (t * testing.T ) {
652
684
ctx , cancel := context .WithTimeout (context .Background (), time .Second * 10 )
653
685
defer cancel ()
0 commit comments