|
1 | 1 | package transport |
2 | 2 |
|
3 | 3 | import ( |
4 | | - "context" |
5 | 4 | "testing" |
6 | 5 |
|
7 | 6 | of "github.com/open-feature/go-sdk/openfeature" |
@@ -112,7 +111,7 @@ func TestGetFlag(t *testing.T) { |
112 | 111 | client: mockClient, |
113 | 112 | } |
114 | 113 |
|
115 | | - actual, err := s.GetFlag(context.Background(), "foo-namespace", "foo") |
| 114 | + actual, err := s.GetFlag(t.Context(), "foo-namespace", "foo") |
116 | 115 | if tt.expectedErr != nil { |
117 | 116 | assert.EqualError(t, err, tt.expectedErr.Error()) |
118 | 117 | } else { |
@@ -168,12 +167,12 @@ func TestEvaluate_NonBoolean(t *testing.T) { |
168 | 167 | client: mockClient, |
169 | 168 | } |
170 | 169 |
|
171 | | - evalCtx := map[string]interface{}{ |
| 170 | + evalCtx := map[string]any{ |
172 | 171 | "requestID": reqID, |
173 | 172 | of.TargetingKey: entityID, |
174 | 173 | } |
175 | 174 |
|
176 | | - actual, err := s.Evaluate(context.Background(), "foo-namespace", "foo", evalCtx) |
| 175 | + actual, err := s.Evaluate(t.Context(), "foo-namespace", "foo", evalCtx) |
177 | 176 | if tt.expectedErr != nil { |
178 | 177 | assert.ErrorContains(t, err, tt.expectedErr.Error()) |
179 | 178 | } else { |
@@ -207,23 +206,23 @@ func TestEvaluate_Boolean(t *testing.T) { |
207 | 206 | client: mockClient, |
208 | 207 | } |
209 | 208 |
|
210 | | - evalCtx := map[string]interface{}{ |
| 209 | + evalCtx := map[string]any{ |
211 | 210 | "requestID": reqID, |
212 | 211 | of.TargetingKey: entityID, |
213 | 212 | } |
214 | 213 |
|
215 | | - actual, err := s.Boolean(context.Background(), "foo-namespace", "foo", evalCtx) |
| 214 | + actual, err := s.Boolean(t.Context(), "foo-namespace", "foo", evalCtx) |
216 | 215 | assert.NoError(t, err) |
217 | 216 | assert.False(t, actual.Enabled, "match value should be false") |
218 | 217 | } |
219 | 218 |
|
220 | 219 | func TestEvaluateInvalidContext(t *testing.T) { |
221 | 220 | s := &Service{} |
222 | 221 |
|
223 | | - _, err := s.Evaluate(context.Background(), "foo-namespace", "foo", nil) |
| 222 | + _, err := s.Evaluate(t.Context(), "foo-namespace", "foo", nil) |
224 | 223 | assert.EqualError(t, err, of.NewInvalidContextResolutionError("evalCtx is nil").Error()) |
225 | 224 |
|
226 | | - _, err = s.Evaluate(context.Background(), "foo-namespace", "foo", map[string]interface{}{}) |
| 225 | + _, err = s.Evaluate(t.Context(), "foo-namespace", "foo", map[string]any{}) |
227 | 226 | assert.EqualError(t, err, of.NewTargetingKeyMissingResolutionError("targetingKey is missing").Error()) |
228 | 227 | } |
229 | 228 |
|
|
0 commit comments