Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Small cleanups and documentation #38

Merged
merged 2 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Confidence OpenFeature Go Provider

This repo contains the OpenFeature Go flag provider for Confidence.
This repo contains the OpenFeature Go flag provider for [Confidence](https://confidence.spotify.com/).

## OpenFeature

Expand Down Expand Up @@ -55,7 +55,7 @@ client := openfeature.NewClient("testApp")
attributes := make(map[string]interface{})
attributes["country"] = "SE"
attributes["plan"] = "premium"
attributes["user_id"] = "dennis"
attributes["user_id"] = "user1"

boolValue, error := client.BooleanValue(context.Background(), "test-flag.boolean-key", false,
openfeature.NewEvaluationContext("", attributes))
Expand Down
22 changes: 11 additions & 11 deletions pkg/provider/provider_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestResolveBoolValue(t *testing.T) {

evalDetails, _ := client.BooleanValueDetails(
context.Background(), "test-flag.boolean-key", false, openfeature.NewEvaluationContext(
"dennis",
"user1",
attributes))

assert.Equal(t, true, evalDetails.Value)
Expand All @@ -43,7 +43,7 @@ func TestResolveIntValue(t *testing.T) {

evalDetails, _ := client.IntValueDetails(
context.Background(), "test-flag.integer-key", 99, openfeature.NewEvaluationContext(
"dennis",
"user1",
attributes))

assert.Equal(t, int64(40), evalDetails.Value)
Expand All @@ -55,7 +55,7 @@ func TestResolveDoubleValue(t *testing.T) {

evalDetails, _ := client.FloatValueDetails(
context.Background(), "test-flag.double-key", 99.99, openfeature.NewEvaluationContext(
"dennis",
"user1",
attributes))

assert.Equal(t, 20.203, evalDetails.Value)
Expand All @@ -67,7 +67,7 @@ func TestResolveStringValue(t *testing.T) {

evalDetails, _ := client.StringValueDetails(
context.Background(), "test-flag.string-key", "default", openfeature.NewEvaluationContext(
"dennis",
"user1",
attributes))

assert.Equal(t, "treatment", evalDetails.Value)
Expand All @@ -79,7 +79,7 @@ func TestResolveObjectValue(t *testing.T) {

evalDetails, _ := client.ObjectValueDetails(
context.Background(), "test-flag.struct-key", "default", openfeature.NewEvaluationContext(
"dennis",
"user1",
attributes))

_, ok := evalDetails.Value.(map[string]interface{})
Expand All @@ -92,7 +92,7 @@ func TestResolveNestedValue(t *testing.T) {

evalDetails, _ := client.BooleanValueDetails(
context.Background(), "test-flag.struct-key.boolean-key", true, openfeature.NewEvaluationContext(
"dennis",
"user1",
attributes))

assert.Equal(t, false, evalDetails.Value)
Expand All @@ -104,7 +104,7 @@ func TestResolveWholeFlagAsObject(t *testing.T) {

evalDetails, _ := client.ObjectValueDetails(
context.Background(), "test-flag", "default", openfeature.NewEvaluationContext(
"dennis",
"user1",
attributes))

_, ok := evalDetails.Value.(map[string]interface{})
Expand All @@ -117,7 +117,7 @@ func TestResolveWholeFlagAsObjectWithInts(t *testing.T) {

evalDetails, _ := client.ObjectValueDetails(
context.Background(), "test-flag", "default", openfeature.NewEvaluationContext(
"dennis",
"user1",
attributes))

value, _ := evalDetails.Value.(map[string]interface{})
Expand All @@ -138,7 +138,7 @@ func TestResolveWithWrongType(t *testing.T) {

evalDetails, _ := client.BooleanValueDetails(
context.Background(), "test-flag.integer-key", false, openfeature.NewEvaluationContext(
"dennis",
"user1",
attributes))

assert.Equal(t, false, evalDetails.Value)
Expand All @@ -152,7 +152,7 @@ func TestResolveWithUnexpectedFlag(t *testing.T) {

evalDetails, _ := client.BooleanValueDetails(
context.Background(), "test-flag.boolean-key", true, openfeature.NewEvaluationContext(
"dennis",
"user1",
attributes))

assert.Equal(t, true, evalDetails.Value)
Expand All @@ -167,7 +167,7 @@ func TestResolveWithNonExistingFlag(t *testing.T) {

evalDetails, _ := client.BooleanValueDetails(
context.Background(), "test-flag.boolean-key", true, openfeature.NewEvaluationContext(
"dennis",
"user1",
attributes))

assert.Equal(t, true, evalDetails.Value)
Expand Down
Loading