Readplace

A Test Is As Good As Its Ability To Fail When It Needs To

fagnerbrack.com 4 min read
View original
Summary (TL;DR)
The article warns that tests can give false positives when the tested action brings the system back to its default state.  For example, testing a modal close button can pass even if the button is removed, because jQuery silently ignores missing elements.  This happens when an action returns the component to a negative-by-default state.  Solutions include asserting the open state before closing or using a DOM API that throws on missing elements.  The key is to write tests that actually verify the functionality, not just pass.