Others record what the code does now, whether or not that is right.
Snapshot test
A test that saves the output once to a file, then fails whenever later output differs. It tells you something changed. It can't tell you whether the change is good.
When a snapshot fails, the easy way out is one flag that rewrites the file, and an agent will take it. Your bug is now the expected answer, and the test will defend it.
Say it to your agent
“A snapshot failed. Do not run --update-snapshots yet. Show me the diff of the snapshot file, and say in one sentence why each changed line is intended. I will decide.”