U03
Hook re-checks and racesValidated
useDeviceIntegrity re-checks on foreground, ignores stale responses and keeps the previous result while refreshing.
How to read this page
A scenario is one test case: prepare the environment, run the steps, then compare the expected result (written before the run) with the observed result (copied from the run, with screenshots).
- U03 · U
- Automated test that runs on every code change — no device.
- Validated
- Run, and the result matched what was expected.
Why it matters
A device can become compromised while the app is in the background.
Environment
- Runner
- Jest + React Native Testing Library, in CI
Setup
Prepare the environment.Then run the steps.
- 01Render the hook with a mocked checkIntegrity.
Steps
What to run.What to read.
- 01Background → active transition.
- 02Two overlapping checks.
- 03Unmount mid-check.
Expected result · written before the run
No single pass/fail status.No signals.
Latest request wins; no update after unmount.
Observed result · copied from the run
No single pass/fail status.Observed 2026-09-30.
useDeviceIntegrity.test.tsx passes.Checks this scenario covers
Every check this test case touches — including ones that aren't expected to fire here. The expected and observed results above say which ones should and did. Each links to how the check works.