-
Notifications
You must be signed in to change notification settings - Fork 83
fix(event-tags): do not exclude falsy revenue and event values in the event payload #213
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
I am running @nchilada's compat suite tests here: https://travis-ci.com/optimizely/fullstack-sdk-compatibility-suite/builds/98673737 |
It passes @nchilada's tests here: https://travis-ci.com/optimizely/fullstack-sdk-compatibility-suite/builds/98673737 |
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
@@ -133,12 +133,12 @@ function getVisitorSnapshot(configObj, eventKey, eventTags, logger) { | |||
|
|||
if (eventTags) { | |||
var revenue = eventTagUtils.getRevenueValue(eventTags, logger); | |||
if (revenue) { | |||
if (revenue !== null) { |
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.
Should we check for undefined?
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.
Nah because the getRevenueValue
function will always return either null
or the parsed value
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.
The most robust (redundant) solution would be to check whether the returned value is a number, but I'm not sure it matters
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.
Thanks for fixing this!
@@ -133,12 +133,12 @@ function getVisitorSnapshot(configObj, eventKey, eventTags, logger) { | |||
|
|||
if (eventTags) { | |||
var revenue = eventTagUtils.getRevenueValue(eventTags, logger); | |||
if (revenue) { | |||
if (revenue !== null) { |
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.
The most robust (redundant) solution would be to check whether the returned value is a number, but I'm not sure it matters
@@ -1097,6 +1097,54 @@ describe('lib/core/event_builder', function() { | |||
assert.deepEqual(actualParams, expectedParams); | |||
}); | |||
|
|||
it('should include falsy revenue values in the event object', 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.
Maybe just mention 0
directly? The current test name incorrectly implies that NaN
and non-numeric falsy values like ''
would also be sent.
Summary
null
instead of performing a truthy check because the utility method will returnnull
if the revenue or event values cannot be parsed from the tags.Test plan