test: switch to regex rather than asserting against whole object#497
test: switch to regex rather than asserting against whole object#497
Conversation
vchudnov-g
left a comment
There was a problem hiding this comment.
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 <vchudnov@google.com>
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