It can’t magically know expectations. If the code is well documented or there’s decent associated documentation, I’ve found it has no issue writing tests.
I'm actually surprised at how well non-frontier/local models are able to infer the intent of code from the structure, method names and sparse random comments to the point that they are capable of writing reasonable tests.
Tests are usually the best documentation and often the only documentation. If humans bother to write anything it should be the tests, not ambiguous human language...beyond the high level 1-liner overviews.