DEV Community

Discussion on: Your AI's code is "almost right". Here are 7 ways it fools you, and the 30-second check for each

Collapse
 
maxbuildsdev profile image
Max Kaya •

The test-diff check (#2) is the one I'd put first — it catches the sneaky failure mode. My addition: also grep the diff for assertion weakening, not just skips. The tell-tale pattern is toBe/toEqual downgrading to toBeTruthy/toBeDefined, or a timeout extended "to fix flakiness" — usually means the test now passes by construction.

4's "which 3 inputs would break this?" is genuinely better than asking for edge cases in the abstract. Curious whether you've seen the swallowed-catch one (#5) show up more in AI-generated Express handlers than elsewhere — that's where I keep finding catch { return [] }.

Collapse
 
wst2002rk profile image
Wageesha Tripathi •

Thank you, glad the test-diff one was useful! You're right about weakened assertions. proof-of-done already flags toBe/toEqual turning into toBeTruthy/toBeDefined, here's a short demo and the code. The longer timeout "to fix flakiness" is a good point, it doesn't check that yet. Have you seen it more in Jest unit tests or in e2e tests like Playwright?