@@ -695,6 +695,31 @@ func TestWorkflowExecutionEventHandler_ProcessEvent_no_error_events(t *testing.T
695695 }
696696}
697697
698+ func TestSideEffect (t * testing.T ) {
699+ t .Run ("replay" , func (t * testing.T ) {
700+ weh := testWorkflowExecutionEventHandler (t , newRegistry ())
701+ weh .workflowEnvironmentImpl .isReplay = true
702+ weh .sideEffectResult [weh .counterID ] = []byte ("test" )
703+ weh .SideEffect (func () ([]byte , error ) {
704+ t .Error ("side effect should not be called during replay" )
705+ t .Failed ()
706+ return nil , assert .AnError
707+ }, func (result []byte , err error ) {
708+ assert .NoError (t , err )
709+ assert .Equal (t , "test" , string (result ))
710+ })
711+ })
712+ t .Run ("success" , func (t * testing.T ) {
713+ weh := testWorkflowExecutionEventHandler (t , newRegistry ())
714+ weh .SideEffect (func () ([]byte , error ) {
715+ return []byte ("test" ), nil
716+ }, func (result []byte , err error ) {
717+ assert .NoError (t , err )
718+ assert .Equal (t , "test" , string (result ))
719+ })
720+ })
721+ }
722+
698723func testWorkflowExecutionEventHandler (t * testing.T , registry * registry ) * workflowExecutionEventHandlerImpl {
699724 return newWorkflowExecutionEventHandler (
700725 testWorkflowInfo ,
0 commit comments