-
Notifications
You must be signed in to change notification settings - Fork 90
test: switch to regex rather than asserting against whole object #497
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
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.
Yeah, I'm guessing the new structure probably captures the original intent of the test. But that's not to say that the key check you introduced earlier is bad; maybe it's worth keeping as an additional test?
Co-authored-by: Victor Chudnovsky <[email protected]>
One argument I'd make for not keeping it, is it does mean the test will need to be updated as we update the options bag over time. I was wondering if this is needed, given what we're really testing is the serialization. |
The set comparison you introduced earlier and then removed would be an additional test on the options object. I generally agree we don't want to have to make a lot of dependent manual changes when something fundamental changes. However, if we don't check anywhere else for the keys that are in this bag, this would be a good signal in case something accidentally gets deleted. I don't know whether we test these keys elsewhere. I assume new options don't get added all that frequently? (real question; I don't know) So I could go either way, as I'm not super familiar with how these options are used or tested. But my inclination is to add back (in a separate test) the set-based key check you had earlier, precisely as a safequard against accidental deletion. But I'm certainly not fixated on this, and am happy to hear reasons not to. @parthea , WDYT? |
Okay, I've added it back. |
The goal of this test is to assert against the helper:
Rather than asserting against the whole object which is fragile, this just uses a regex to make sure that we've populated the prefix and the keys.
Fixes #449, #492
FYI: here's the commit for the original test, which I believe a simple regex that asserts the basic structure of the serialized object is closer to the spirit of b6cea3c