Skip to content

feat(api): Feature variable APIs now return default variable value when featureEnabled property is false. #249

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

Merged
merged 10 commits into from
Apr 4, 2019

Conversation

mfahadahmed
Copy link
Contributor

Summary

  • Feature variable APIs now return default variable value when featureEnabled property is false.

Test plan

  • Added unit tests.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 97.752% when pulling 9612b9c on fahad/feature-enable-checking into b9a9fd0 on master.

@coveralls
Copy link

coveralls commented Mar 25, 2019

Coverage Status

Coverage increased (+0.04%) to 97.834% when pulling 47b48f9 on fahad/feature-enable-checking into 3c69a02 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 97.752% when pulling 9612b9c on fahad/feature-enable-checking into b9a9fd0 on master.

)
);
var value = projectConfig.getVariableValueForVariation(this.configObj, variable, decision.variation, this.logger);
if (value) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be value !== null? What if value is an empty string?

@@ -519,7 +519,8 @@ module.exports = {

var variableUsages = projectConfig.variationVariableUsageMap[variation.id];
var variableUsage = variableUsages[variable.id];
return variableUsage ? variableUsage.value : variable.defaultValue;

return variableUsage ? variableUsage.value : null;
Copy link
Contributor

Choose a reason for hiding this comment

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

The doc comment for this function is now incorrect, given this change.

@mfahadahmed mfahadahmed requested a review from mjc1283 March 28, 2019 18:05
@mfahadahmed
Copy link
Contributor Author

build

Copy link
Contributor

@mjc1283 mjc1283 left a comment

Choose a reason for hiding this comment

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

Thanks @mfahadahmed, LGTM.

@msohailhussain
Copy link
Contributor

@jordangarcia are u going to review this PR?

@aliabbasrizvi
Copy link
Contributor

@msohailhussain can you address conflict. I can merge right after.

@aliabbasrizvi aliabbasrizvi removed their assignment Mar 29, 2019
…e-checking

# Conflicts:
#	packages/optimizely-sdk/lib/optimizely/index.js
@mfahadahmed
Copy link
Contributor Author

@aliabbasrizvi Conflicts resolved. Please take a look again.

@jordangarcia
Copy link
Contributor

@msohailhussain can you address conflicts

…e-checking

# Conflicts:
#	packages/optimizely-sdk/lib/core/decision_service/index.tests.js
#	packages/optimizely-sdk/lib/optimizely/index.js
@aliabbasrizvi aliabbasrizvi merged commit dd8c502 into master Apr 4, 2019
@aliabbasrizvi aliabbasrizvi deleted the fahad/feature-enable-checking branch April 4, 2019 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants