Skip to content

Commit 1b8d63b

Browse files
committed
test: update reason handling in test
1 parent 5cfa527 commit 1b8d63b

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

pkg/provider_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func TestBooleanEvaluation(t *testing.T) {
143143
defaultValue: false,
144144
expectedValue: false,
145145
expectedReason: openfeature.ErrorReason,
146-
expectedResolutionError: openfeature.NewTargetingKeyMissingResolutionError(`key "targetingKey", value '{' can not be converted to string`),
146+
expectedResolutionError: openfeature.NewTargetingKeyMissingResolutionError(`key "targetingKey", value 123 can not be converted to string`),
147147
failToBucketeerUser: false,
148148
boolEvaluation: model.BKTEvaluationDetails[bool]{
149149
FeatureID: "bool-flag",
@@ -326,7 +326,7 @@ func TestStringEvaluation(t *testing.T) {
326326
defaultValue: "default-value",
327327
expectedValue: "default-value",
328328
expectedReason: openfeature.ErrorReason,
329-
expectedResolutionError: openfeature.NewTargetingKeyMissingResolutionError(`key "targetingKey", value '{' can not be converted to string`),
329+
expectedResolutionError: openfeature.NewTargetingKeyMissingResolutionError(`key "targetingKey", value 123 can not be converted to string`),
330330
failToBucketeerUser: false,
331331
stringEvaluation: model.BKTEvaluationDetails[string]{
332332
FeatureID: "string-flag",
@@ -434,7 +434,7 @@ func TestIntEvaluation(t *testing.T) {
434434
defaultValue: 0,
435435
expectedValue: 0,
436436
expectedReason: openfeature.ErrorReason,
437-
expectedResolutionError: openfeature.NewTargetingKeyMissingResolutionError(`key "targetingKey", value '{' can not be converted to string`),
437+
expectedResolutionError: openfeature.NewTargetingKeyMissingResolutionError(`key "targetingKey", value 123 can not be converted to string`),
438438
failToBucketeerUser: false,
439439
int64Evaluation: model.BKTEvaluationDetails[int64]{
440440
FeatureID: "int-flag",
@@ -520,7 +520,7 @@ func TestFloatEvaluation(t *testing.T) {
520520
defaultValue: 0.0,
521521
expectedValue: 0.0,
522522
expectedReason: openfeature.ErrorReason,
523-
expectedResolutionError: openfeature.NewTargetingKeyMissingResolutionError(`key "targetingKey", value '{' can not be converted to string`),
523+
expectedResolutionError: openfeature.NewTargetingKeyMissingResolutionError(`key "targetingKey", value 123 can not be converted to string`),
524524
failToBucketeerUser: false,
525525
float64Evaluation: model.BKTEvaluationDetails[float64]{
526526
FeatureID: "float-flag",
@@ -614,7 +614,7 @@ func TestObjectEvaluation(t *testing.T) {
614614
defaultValue: map[string]interface{}{"default": true},
615615
expectedValue: map[string]interface{}{"default": true},
616616
expectedReason: openfeature.ErrorReason,
617-
expectedResolutionError: openfeature.NewTargetingKeyMissingResolutionError(`key "targetingKey", value '{' can not be converted to string`),
617+
expectedResolutionError: openfeature.NewTargetingKeyMissingResolutionError(`key "targetingKey", value 123 can not be converted to string`),
618618
failToBucketeerUser: false,
619619
objectEvaluation: model.BKTEvaluationDetails[interface{}]{
620620
FeatureID: "object-flag",
@@ -696,7 +696,7 @@ func TestToBucketeerUser(t *testing.T) {
696696
evalCtx: openfeature.FlattenedContext{
697697
openfeature.TargetingKey: 123,
698698
},
699-
expectedErr: errors.New(`TARGETING_KEY_MISSING: key "targetingKey", value '{' can not be converted to string`),
699+
expectedErr: errors.New(`TARGETING_KEY_MISSING: key "targetingKey", value 123 can not be converted to string`),
700700
},
701701
{
702702
desc: "empty context",

test/e2e/provider_local_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"time"
77

88
"github.com/bucketeer-io/go-server-sdk/pkg/bucketeer"
9-
"github.com/bucketeer-io/go-server-sdk/pkg/bucketeer/model"
109
provider "github.com/bucketeer-io/openfeature-go-server-sdk/pkg"
1110
"github.com/open-feature/go-sdk/openfeature"
1211
"github.com/stretchr/testify/assert"
@@ -68,7 +67,7 @@ func TestLocalStringEvaluation(t *testing.T) {
6867
flagID: featureIDString,
6968
defaultValue: "default",
7069
expectedValue: featureIDStringVariation3,
71-
expectedReason: openfeature.Reason(model.EvaluationReasonRule),
70+
expectedReason: openfeature.TargetingMatchReason,
7271
},
7372
}
7473

test/e2e/provider_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"testing"
66

77
"github.com/bucketeer-io/go-server-sdk/pkg/bucketeer"
8-
"github.com/bucketeer-io/go-server-sdk/pkg/bucketeer/model"
98
provider "github.com/bucketeer-io/openfeature-go-server-sdk/pkg"
109
"github.com/open-feature/go-sdk/openfeature"
1110
"github.com/stretchr/testify/assert"
@@ -113,7 +112,7 @@ func TestStringEvaluation(t *testing.T) {
113112
flagID: featureIDString,
114113
defaultValue: "default",
115114
expectedValue: featureIDStringVariation3,
116-
expectedReason: openfeature.Reason(model.EvaluationReasonRule),
115+
expectedReason: openfeature.TargetingMatchReason,
117116
},
118117
}
119118

0 commit comments

Comments
 (0)