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

fix: Don't find/replace FLAG_KEY in SDK instructions #193

Merged
merged 2 commits into from
Apr 22, 2024
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
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",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There aren't any "FLAG_KEY" values to replace with the new SDK instruction examples.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can get rid of all of these except for the ones above the comment line now that we've made them all the same value?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing with sdk key -- I forgot to clean that up when I removed the old instructions.

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
Loading