If you get a renewal notice where live, you should be able to bring that notice to the testing station as soon as you receive it, and get the car tested.
When we did emissions testing here, they allowed up to 2 free retests. After the third failed test, each additional test was about $8. I know you had at least a month, probably closer to two months, to get the car fixed.