Need some answers please

If I had unprotected sex on the last day of ovulation and took a plan b pill, will it work to prevent pregnancy or am I at risk for possible pregnancy still? If so when would I need to take a pregnancy test as my normal period is due to start in 9 days??