You would know in a similar way to a colleague of yours having done this code the previous day, or you joining a company with legacy code. It either has tests or you can't really trust it anyway regardless. You can ask the AI to also write tests for you, inspecting tests is usually much faster than understanding all the nuances of the code.