When do I test?

I have irregular periods so I am not sure when to take a pregnancy test? How many weeks after unprotected sex should I test? According to this app, my period is “22 days late” but thats based off my 2 periods that were somewhat a regular cycle. Thanks in advanced