|
1 | 1 | package mocks |
2 | 2 |
|
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 | +) |
4 | 7 |
|
5 | 8 | // MockEvaluator mock evaluator |
6 | 9 | 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 |
10 | 11 | } |
11 | 12 |
|
12 | 13 | // EvaluateFeature mock |
13 | 14 | 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) |
15 | 17 | } |
16 | 18 |
|
17 | 19 | // EvaluateFeatures mock |
18 | 20 | 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) |
20 | 23 | } |
21 | 24 |
|
22 | 25 | // EvaluateFeaturesByFlagSets mock |
23 | 26 | 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) |
25 | 29 | } |
0 commit comments