Is an item still present with the correct quantity after the browser reloads?
The original implementation failed the “Reload saved cart” check. Expected 3 and observed 0. The corrected implementation met both expectations on the same inputs.
What the control case missed
An empty cart makes both implementations look healthy. Reloading a stored quantity of three distinguishes a genuine restoration from silently starting again at zero.
| Check | Expected | Original | Corrected |
|---|---|---|---|
| New cart | 0 | 0 | 0 |
| Reload saved cart | 3 | 0 | 3 |
What to check before merging
Check that the app restores the right cart before rendering the final quantity. Preserve a second check for missing, expired or malformed storage. This small case reads a saved JSON value and does not exercise a real browser.
Reproduce the recorded result
Download the Node.js fixture and run node run.mjs lost-cart-after-refresh with Node.js 24. Compare the printed JSON with the recorded results. This is a locally executed model of the regression, using synthetic inputs. It covers the rule shown here. Hosted runs, browser behaviour and customer PRs require their own evidence.