Guides · Mocks
How to test an empty state without changing the database
By Marlon Maniti · Last updated
Short answer: have the list endpoint return an empty array in the
browser instead of emptying your database. With DevHeader, capture the real
request in DevTools, click Add to Mocks, replace the list in the body
with [], and reload.
Why not just delete the data?
Deleting rows in a shared dev or staging database breaks things for other people, and recreating test data takes time. The empty state is also often the screen nobody sees until a real new user does, so it's worth checking on every release.
Without an extension
- Use a fresh account or tenant with no data. Realistic, but you need one for every list you want to check.
- Feature-flag the API to return nothing. Needs a backend change.
- Chrome DevTools Local Overrides. Right-click the request in the Network
panel, choose Override content, pick a folder for override files, and
edit the saved response. This works for a status-
200response and is a good option if you already use Overrides. The override is stored as a file per URL.
With DevHeader
Install DevHeader and turn on Allow User Scripts on its details page in
chrome://extensions(Chrome 138+). Open the popup once and click Allow access.Open DevTools → DevHeader panel and reload the page.
In Live Status, select the list request (for example
GET /api/projects) and click Add to Mocks. The new rule is a copy of the real response and starts disabled.Select the rule in Mock Management and edit Response Body. Keep the shape your client expects and empty the list:
{ "projects": [], "total": 0 }Click Save, enable the rule, and reload.
To check pagination edge cases, add a query param to the rule (for example
page = 3) so only that page comes back empty.
Check that it worked
Your page shows its empty state, and Live Status shows a MOCK badge on the request. The rest of the app still talks to the real API.
Limitations
- Mocks replace
fetch/XHR responses only. Lists rendered by the server into the HTML aren't affected. - Mocks need Chrome 138+ with Allow User Scripts on.
FAQ
Can I keep several versions? Yes. Duplicate the rule (the copy starts disabled), give each one a name such as "Projects: empty" and "Projects: one item", and turn on the one you need.
Can my team use the same mocks? Export the profile from Manage Profiles and share the JSON file; importing never overwrites anyone's existing profiles.
Sources
Try DevHeader
DevHeader is free, keeps every rule on your machine, and only touches sites you grant it access to. Install it from the Chrome Web Store or Edge Add-ons.
