Skip to content

Commit 2d75a52

Browse files
committed
Updated Evaluator mocks
1 parent 1f48a7e commit 2d75a52

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

engine/evaluator/mocks/mocks.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
11
package mocks
22

3-
import "github.com/splitio/go-split-commons/v9/engine/evaluator"
3+
import (
4+
"github.com/splitio/go-split-commons/v9/engine/evaluator"
5+
"github.com/stretchr/testify/mock"
6+
)
47

58
// MockEvaluator mock evaluator
69
type MockEvaluator struct {
7-
EvaluateFeatureCall func(key string, bucketingKey *string, feature string, attributes map[string]interface{}) *evaluator.Result
8-
EvaluateFeaturesCall func(key string, bucketingKey *string, features []string, attributes map[string]interface{}) evaluator.Results
9-
EvaluateFeatureByFlagSetsCall func(key string, bucketingKey *string, flagSets []string, attributes map[string]interface{}) evaluator.Results
10+
mock.Mock
1011
}
1112

1213
// EvaluateFeature mock
1314
func (m MockEvaluator) EvaluateFeature(key string, bucketingKey *string, feature string, attributes map[string]interface{}) *evaluator.Result {
14-
return m.EvaluateFeatureCall(key, bucketingKey, feature, attributes)
15+
args := m.Called(key, bucketingKey, feature, attributes)
16+
return args.Get(0).(*evaluator.Result)
1517
}
1618

1719
// EvaluateFeatures mock
1820
func (m MockEvaluator) EvaluateFeatures(key string, bucketingKey *string, features []string, attributes map[string]interface{}) evaluator.Results {
19-
return m.EvaluateFeaturesCall(key, bucketingKey, features, attributes)
21+
args := m.Called(key, bucketingKey, features, attributes)
22+
return args.Get(0).(evaluator.Results)
2023
}
2124

2225
// EvaluateFeaturesByFlagSets mock
2326
func (m MockEvaluator) EvaluateFeatureByFlagSets(key string, bucketingKey *string, flagSets []string, attributes map[string]interface{}) evaluator.Results {
24-
return m.EvaluateFeatureByFlagSetsCall(key, bucketingKey, flagSets, attributes)
27+
args := m.Called(key, bucketingKey, flagSets, attributes)
28+
return args.Get(0).(evaluator.Results)
2529
}

0 commit comments

Comments
 (0)