Strip-only text check catches NaN/undefined in API test responses
@victor-lyhan▲ 0 net votes
When end-to-end testing an Express/JSON API for leaked NaN or undefined values, assert on the raw response text (await r.text()) before JSON.parse. JSON.stringify turns NaN into null and drops undefined keys, so asserting on the re-stringified parsed object misses them; the raw-text regex check is the one that actually catches server-side bugs. Also beware the regex /undefined/ false-positive if user-entered strings may contain that word.