Generally it's antibody tests that detect past infection rather than PCR tests. Technically you can find bits of viral RNA in the throat after all the live viruses are dead so you have a chance of getting a positive PCR right after a person has recovered but I don't think that's what you mean.