The habit is almost universal, which is precisely what makes it dangerous. When you're writing tests for a flow that includes phone-based two-factor authentication, you mock the SMS step. You stub the call, return a fake token, the test goes green, you move on. Nobody questions it because everyone does it. The first Dev.to signal — "Why I Stopped Mocking 2FA in Tests" — is one developer's account of doing exactly that for years, until they didn't. The reckoning, when it came, wasn't a dramatic breach or a public postmortem. It was quieter and worse: a pattern of passing tests that had stopped describing reality, covering code paths that diverged from how the actual SMS provider behaved in production. The second signal, "The Hidden Cost of Phone-Based Auth: What I Learned After 18 Months," arrives from a different author but lands in the same place — eighteen months of accumulated friction, edge cases, and maintenance overhead that never showed up in a green test suite but showed up everywhere else. What emerges across both pieces is less a technical argument than a confession, and confessions from developers about testing practices tend to travel, because the guilt is usually shared.
If confirmed, here is what this means. The problem isn't mocking as a technique — it's mocking at the boundary where your code meets a carrier network and a physical device, a boundary that is genuinely unreliable and genuinely important, and treating that boundary as though it behaves like a pure function. The teams most exposed are those who have built QA pipelines around the assumption that 2FA is a commodity step rather than a failure domain in its own right. Second-order effects include authentication bugs that only surface under specific carrier conditions, race conditions in token expiry that integration tests would catch and unit tests cannot, and a false confidence that compounds every time a developer inherits the test suite and assumes the coverage is real. The strategic implication for any team running phone-based auth at scale is uncomfortable but clear: your test coverage for the most security-critical step in your login flow may be measuring your mocks, not your system.
Watch for this conversation moving from Dev.to into engineering blogs at companies running consumer-scale authentication — that would signal the pain is structural, not anecdotal. A response from any major SMS API provider addressing testability would change the picture considerably.
<h3> Most authentication systems don’t fail because developers can’t implement login. They fail because production security is very different from tutorial security. </h3>
<h2> TL;DR </h2> <p>For a simple SMS 2FA login flow, keep a short-lived attempt record in your backend, let a verification service own the OTP secret, and authorize only after a
<p>Most Playwright suites stop right before the hard part of a signup flow: the "confirm your email" link, the emailed 6-digit code, the password-reset mail. The usual reasons are
<p><em>Three API calls. One template ID that has to carry through all of them.</em></p> <p>Resend's API for sending a templated email is three steps:</p> <ol> <li>Create a
<h1> Stop Testing Signup Flows With Your Real Email </h1> <p>I'm Muhammad Huzaifa, founder of <a href="https://www.toolxz.com" rel="noopener noreferrer">Toolxz</a> — a site with
<p>Rails developers test email one of three ways, and each verifies something different.</p> <p><strong><code>ActionMailer::Base.deliveries</code></strong> — the test adapter
<p>You built an AI agent that onboards to a new service, creates an account, fills in a form, and gets all the way to SMS verification — then hits a wall.<br /> </p> <div
<p>The API makes it look trivial.<br /> </p> <div class="highlight js-code-highlight"> <pre class="highlight typescript"><code><span class="kd">const</span> <span
NewsHive monitors these sources continuously. All signal titles above link to the original reporting.
Intelligence by NewsHive. Need help navigating what this means for your business? Contact GeekyBee →