-
Notifications
You must be signed in to change notification settings - Fork 83
feat: Implement IGNORE_USER_PROFILE_SERVICE flag in decide options #642
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
Conversation
8944a95
to
c57e416
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. See a few changes suggested.
@@ -5621,6 +5621,50 @@ describe('lib/optimizely', function() { | |||
); | |||
}); | |||
}); | |||
|
|||
describe('with IGNORE_USER_PROFILE_SERVICE flag in decide options', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test looks good. Can you do the same test with "IGNORE_USER_PROFILE" in defaultDecideOptions?
* @param {string} experimentKey | ||
* @param {string} userId | ||
* @param {Object} attributes | ||
* @param {OptimizelyDecideOptions[]} options Decide options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix this type. Not an array.
var shouldIgnoreUPS = options[OptimizelyDecideOptions.IGNORE_USER_PROFILE_SERVICE]; | ||
|
||
// check for sticky bucketing if decide options do not include shouldIgnoreUPS | ||
if (!shouldIgnoreUPS) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be used to bypass "saveUserProfile" as well.
I see a test case confirming this save bypass. Wondering how the test passed :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe "saveUserProfile" should not be called in this case since we are returning stored variation. I wrapped __saveUserProfile
call below in if (!shouldIgnoreUPS) {..}
statement and added a unit test to incorporate this comment.
af78f6f
to
4041f2b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…gnoreUPS * Update getVariationForFeature method to include options * Fix existing unit test * Add unit test for IGNORE_USER_PROFILE_SERVICE flag in decide options
4041f2b
to
396e0e2
Compare
Summary
Test plan
Note
This pr is to be finalized once #640 is merged