Example made for Women Can Code, day 4. The AI's code passed a quick look; the tests found the bug.

Make the AI prove it

$ npm test

✓ averages confidence across topics
✓ sorts weakest topic first
✗ handles a topic with no score yet
    expected: "not scored"   received: NaN
✓ rejects a score above 5

3 passing, 1 failing
# The AI divided by zero when a topic had no score.
# I asked it to explain the failing line, fixed it myself, and kept the test.

$ npm test
4 passing