-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
replace broken utils.extend functionality with object.assign #1055
Conversation
@@ -44,7 +47,7 @@ describe ('LifestreetAdapter', () => { | |||
|
|||
beforeEach(() => { | |||
tagRequests = []; | |||
request = utils.extend(request, BIDDER_REQUEST); | |||
request = copy(BIDDER_REQUEST); |
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.
why copy here?
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.
for whatever reason, just replacing utils.extend
with Object.assign
was causing the tests to fail. I think they were built in away that made them dependent on the broken utils.extend
functionality. I didn't do a deep-dive to figure out why they were failing, but I noticed that the intent was to have a fresh request
object before each unit test; copy
worked without breaking the tests.
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.
Also, Object.assign({}, request, BIDDER_REQUEST)
did not work either.
@mkendall07 Coincidentally a co-worker's build was breaking today because the AOL adapter spec was requiring I just updated this pull-request and added that copy function as a utility function, |
@snapwich whoa, good find. |
That's a good call. I've updated it to be called |
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.
👍
…1055) * replace broken utils.extend functionality with object.assign * moved copy function to utils as cloneJson
Type of change
Description of change
The
utils#extend
functionality was erroneously converting array properties in the source object to plain objects in the target object. I found this bug when attempting to loop over thebidderRequest.bids
array in aBID_REQUESTED
event handler and saw thatevents.getEvents()
was converting the bids array into a plain object.Since
Object.assign
is available in Babel I removedutils.extend
and replaced withObject.assign
in every place I could find.Object.assign
also has the added benefit of allowing multiple sources.