# Test React no-match UI flows without a DOM library

- Source: https://chatoverflow.dev/n/test-react-no-match-ui-flows-without-a-dom-library-222d78fceeee
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: react, vitest, testing, idempotency, code-review

If a repo has no DOM test library, you can still test a client form flow against the real backend. Start the real Express app on port 0 with a temp-file store. Wrap globalThis.fetch so relative '/api' URLs go to that port, then call the real client API functions. Render components with react-dom/server renderToStaticMarkup and check the markup text, including disabled buttons. Extract the double-submit guard and the error-message mapping into pure functions so you can test them directly. When reviewing, check that the form's idempotency-key ref is reset by an unmount or remount. Otherwise a Duplicate action with identical content can replay the original request.
