@@ -224,7 +224,6 @@ func TestRequirement_1_4_9(t *testing.T) {
224224 Return (BoolResolutionDetail {
225225 Value : false ,
226226 ResolutionDetail : ResolutionDetail {
227- Value : false ,
228227 ErrorCode : "GENERAL" ,
229228 Reason : "forced test error" ,
230229 },
@@ -260,7 +259,6 @@ func TestRequirement_1_4_9(t *testing.T) {
260259 Return (StringResolutionDetail {
261260 Value : "foo" ,
262261 ResolutionDetail : ResolutionDetail {
263- Value : "foo" ,
264262 ErrorCode : "GENERAL" ,
265263 Reason : "forced test error" ,
266264 },
@@ -296,7 +294,6 @@ func TestRequirement_1_4_9(t *testing.T) {
296294 Return (FloatResolutionDetail {
297295 Value : 0 ,
298296 ResolutionDetail : ResolutionDetail {
299- Value : 0 ,
300297 ErrorCode : "GENERAL" ,
301298 Reason : "forced test error" ,
302299 },
@@ -332,7 +329,6 @@ func TestRequirement_1_4_9(t *testing.T) {
332329 Return (IntResolutionDetail {
333330 Value : 0 ,
334331 ResolutionDetail : ResolutionDetail {
335- Value : 0 ,
336332 ErrorCode : "GENERAL" ,
337333 Reason : "forced test error" ,
338334 },
@@ -368,10 +364,11 @@ func TestRequirement_1_4_9(t *testing.T) {
368364 mockProvider .EXPECT ().Metadata ().AnyTimes ()
369365 mockProvider .EXPECT ().Hooks ().AnyTimes ()
370366 mockProvider .EXPECT ().ObjectEvaluation (flagKey , defaultValue , flatCtx ).
371- Return (ResolutionDetail {
372- Value : obj {foo : "foo" },
373- ErrorCode : "GENERAL" ,
374- Reason : "forced test error" ,
367+ Return (InterfaceResolutionDetail {
368+ ResolutionDetail : ResolutionDetail {
369+ ErrorCode : "GENERAL" ,
370+ Reason : "forced test error" ,
371+ },
375372 }).Times (2 )
376373 SetProvider (mockProvider )
377374
@@ -413,74 +410,6 @@ func TestRequirement_1_4_9(t *testing.T) {
413410// The `client` SHOULD transform the `evaluation context` using the `provider's` `context transformer` function
414411// if one is defined, before passing the result of the transformation to the provider's flag resolution functions.
415412
416- func TestClient_ProviderEvaluationReturnsUnexpectedType (t * testing.T ) {
417- client := NewClient ("test-client" )
418-
419- t .Run ("Boolean" , func (t * testing.T ) {
420- defer t .Cleanup (initSingleton )
421- ctrl := gomock .NewController (t )
422- mockProvider := NewMockFeatureProvider (ctrl )
423- mockProvider .EXPECT ().Metadata ().AnyTimes ()
424- SetProvider (mockProvider )
425- mockProvider .EXPECT ().Hooks ().AnyTimes ()
426- mockProvider .EXPECT ().BooleanEvaluation (gomock .Any (), gomock .Any (), gomock .Any ()).
427- Return (BoolResolutionDetail {ResolutionDetail : ResolutionDetail {Value : 3 }})
428-
429- _ , err := client .BooleanValue ("" , false , EvaluationContext {}, EvaluationOptions {})
430- if err == nil {
431- t .Error ("expected BooleanValue to return an error, got nil" )
432- }
433- })
434-
435- t .Run ("String" , func (t * testing.T ) {
436- defer t .Cleanup (initSingleton )
437- ctrl := gomock .NewController (t )
438- mockProvider := NewMockFeatureProvider (ctrl )
439- mockProvider .EXPECT ().Metadata ().AnyTimes ()
440- SetProvider (mockProvider )
441- mockProvider .EXPECT ().Hooks ().AnyTimes ()
442- mockProvider .EXPECT ().StringEvaluation (gomock .Any (), gomock .Any (), gomock .Any ()).
443- Return (StringResolutionDetail {ResolutionDetail : ResolutionDetail {Value : 3 }})
444-
445- _ , err := client .StringValue ("" , "" , EvaluationContext {}, EvaluationOptions {})
446- if err == nil {
447- t .Error ("expected StringValue to return an error, got nil" )
448- }
449- })
450-
451- t .Run ("Float" , func (t * testing.T ) {
452- defer t .Cleanup (initSingleton )
453- ctrl := gomock .NewController (t )
454- mockProvider := NewMockFeatureProvider (ctrl )
455- mockProvider .EXPECT ().Metadata ().AnyTimes ()
456- SetProvider (mockProvider )
457- mockProvider .EXPECT ().Hooks ().AnyTimes ()
458- mockProvider .EXPECT ().FloatEvaluation (gomock .Any (), gomock .Any (), gomock .Any ()).
459- Return (FloatResolutionDetail {ResolutionDetail : ResolutionDetail {Value : false }})
460-
461- _ , err := client .FloatValue ("" , 3 , EvaluationContext {}, EvaluationOptions {})
462- if err == nil {
463- t .Error ("expected FloatValue to return an error, got nil" )
464- }
465- })
466-
467- t .Run ("Int" , func (t * testing.T ) {
468- defer t .Cleanup (initSingleton )
469- ctrl := gomock .NewController (t )
470- mockProvider := NewMockFeatureProvider (ctrl )
471- mockProvider .EXPECT ().Metadata ().AnyTimes ()
472- SetProvider (mockProvider )
473- mockProvider .EXPECT ().Hooks ().AnyTimes ()
474- mockProvider .EXPECT ().IntEvaluation (gomock .Any (), gomock .Any (), gomock .Any ()).
475- Return (IntResolutionDetail {ResolutionDetail : ResolutionDetail {Value : false }})
476-
477- _ , err := client .IntValue ("" , 3 , EvaluationContext {}, EvaluationOptions {})
478- if err == nil {
479- t .Error ("expected IntValue to return an error, got nil" )
480- }
481- })
482- }
483-
484413func TestFlattenContext (t * testing.T ) {
485414 tests := map [string ]struct {
486415 inCtx EvaluationContext
0 commit comments