-
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
ZeopTapId: Fix broken unit tests #5758
Conversation
good to know for future id modules that are doing similar things. does it matter if it's local storage or cookies? i see audigent calls localstorage directly (https://github.com/prebid/Prebid.js/pull/5524/files#diff-d0da60273284688dcaace1e87e2ca3d7R1131) and quantcast is calling setcookie directly too (https://github.com/prebid/Prebid.js/pull/5727/files#diff-58dc06f8386f9012950e1e3e2f67e699R5). @robertrmartinez can you take a look at those two as well to make sure they're fixed if needed? |
It should not matter, as long as they are using the The only downside is not catching something browser specific that changes with cookies. For example, with the CHROME 85 release they did away with the setting of cookies with sameSite none when secure flag not set. So something we may want to talk about, a suite of tests just for storageManager maybe. |
agreed that storageManager should probably have its own tests. the quantcast and audigent tests were passing, so maybe there isn't an issue with them? |
Yeah, depending on how tests are written, it is not 100% that tests will fail when directly accessing local storage or cookies. But we just should not be doing it in my opinion. So I believe a migration of all Wether that be writing some storage mock that will work with all module unit tests, or going to each individual one. Would like to hear from some others @jaiminpanchal27 @jsnellbaker @harpere @msm0504. What do you guys think is the best solution? |
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.
So I think this approach is okay for now and may potentially be something we'd want to replicate/adopt for others doing something similar.
We could try to look into making a unified stub (similar I think to what was attempted with adloader.js
, though I don't know if that was properly utilized). But we'd have to allow for some flexibility for when there are unique tests/params that have to be replaced (like what was done here, where we're supposed to provide a very specific return value when a given function was called).
Curious for other thoughts/opinions.
Yeah, I can try to come up with a universal stub idea when I get some extra time. Then once we agree on it, we can migrate existing ones. But it is a little challenging because of the many functions on storageManagers, not including the hooks into Prob will have to spec the But, for now, importing their own The downside to this is we are not testing browsers capability to set cookies or local storage. So I am curious as to if we want a separate suite of tests which make sure Would at least shed light to changes between browser versions like what we saw with Chrome 84->85. And we can address and let people know if they fail. If everyone is okay with this fix for now, I say we merge it and release And we can come up with the long term solution later? |
Plan sounds good to me. Can you please create an Issue so we don’t forget?
|
Type of change
Description of change
The zeoTap Id system was relying on storageManager to be directly writing cookies in all browsers. This caused circleCi to fail.
So, the real thing all UNIT tests should be doing is mocking their storage manager.
This PR mocks the storage utilities necessary in the zeotap spec file.