replace broken utils.extend functionality with object.assign#1055
replace broken utils.extend functionality with object.assign#1055matthewlane merged 2 commits intoprebid:masterfrom
Conversation
| beforeEach(() => { | ||
| tagRequests = []; | ||
| request = utils.extend(request, BIDDER_REQUEST); | ||
| request = copy(BIDDER_REQUEST); |
There was a problem hiding this comment.
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.
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 |
Type of change
Description of change
The
utils#extendfunctionality 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.bidsarray in aBID_REQUESTEDevent handler and saw thatevents.getEvents()was converting the bids array into a plain object.Since
Object.assignis available in Babel I removedutils.extendand replaced withObject.assignin every place I could find.Object.assignalso has the added benefit of allowing multiple sources.