Skip to content

Commit

Permalink
fix: Don't find/replace FLAG_KEY in SDK instructions (#193)
Browse files Browse the repository at this point in the history
Don't find/replace FLAG_KEY in SDK instructions

This was breaking java and android examples.
  • Loading branch information
dbolson authored Apr 22, 2024
1 parent c7bdcfd commit 39ea1ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 25 deletions.
9 changes: 0 additions & 9 deletions internal/sdks/sdks.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@ func ReplaceFlagKey(instructions string, key string) string {
key,
"myFlagKey",
kebabToCamel(key),
// remove remaining keys when we add all hardcoded instructions
"my-flag",
key,
"my-boolean-flag",
key,
"FLAG_KEY",
key,
"<flag key>",
key,
)

return r.Replace(instructions)
Expand Down
20 changes: 4 additions & 16 deletions internal/sdks/sdks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,14 @@ func TestReplaceFlagKey(t *testing.T) {
body: "# title ```const featureFlagKey = \"my-flag-key\"```",
expected: "# title ```const featureFlagKey = \"real-flag-key\"```",
},
"replaces placeholder my-flag": {
body: "# title ```const featureFlagKey = \"my-flag\"```",
expected: "# title ```const featureFlagKey = \"real-flag-key\"```",
},
"replaces placeholder my-boolean-flag": {
body: "# title ```const featureFlagKey = \"my-boolean-flag\"```",
expected: "# title ```const featureFlagKey = \"real-flag-key\"```",
},
"replaces placeholder FLAG_KEY": {
body: "# title ```const featureFlagKey = \"my-boolean-flag\"```",
expected: "# title ```const featureFlagKey = \"real-flag-key\"```",
},
"replaces placeholder <flag key>": {
body: "# title ```hello_erlang_server:get(<<\"FLAG_KEY\">>)```",
expected: "# title ```hello_erlang_server:get(<<\"real-flag-key\">>)```",
},
"replaces camelCase <myFlagKey>": {
body: "# title ```const featureFlagKey = \"myFlagKey\"```",
expected: "# title ```const featureFlagKey = \"realFlagKey\"```",
},
"does not replace BOOLEAN_FLAG_KEY": {
body: "# title ```val BOOLEAN_FLAG_KEY = \"myFlagKey\"```",
expected: "# title ```val BOOLEAN_FLAG_KEY = \"realFlagKey\"```",
},
}
for name, tt := range tests {
tt := tt
Expand Down

0 comments on commit 39ea1ce

Please sign in to comment.