Skip to content

Commit

Permalink
use assert.ErrorContains() in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ketsiambaku committed Jun 2, 2024
1 parent 8c06a70 commit ec51f3a
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ func TestReplicateDecisionTaskScheduledEvent(t *testing.T) {
}
},
assertions: func(t *testing.T, info *DecisionInfo, err error, observedLogs *observer.ObservedLogs) {
require.Error(t, err)
assert.Equal(t, "unable to change workflow state from 2 to 1, close status 0", err.Error())
assert.ErrorContains(t, err, "unable to change workflow state from 2 to 1, close status 0")
assert.Nil(t, info)
},
},
Expand All @@ -160,8 +159,7 @@ func TestReplicateDecisionTaskScheduledEvent(t *testing.T) {
mgr.msb.taskGenerator.(*MockMutableStateTaskGenerator).EXPECT().GenerateDecisionScheduleTasks(scheduleID).Return(errors.New("some error"))
},
assertions: func(t *testing.T, info *DecisionInfo, err error, observedLogs *observer.ObservedLogs) {
require.Error(t, err)
assert.Equal(t, "some error", err.Error())
assert.ErrorContains(t, err, "some error")
assert.Nil(t, info)
assert.Equal(t, 1, observedLogs.FilterMessage(fmt.Sprintf(
"Decision Updated: {Schedule: %v, Started: %v, ID: %v, Timeout: %v, Attempt: %v, Timestamp: %v}",
Expand Down

0 comments on commit ec51f3a

Please # to comment.