Touching or masturbating are not ways normally STDs spread. There would be a theoretical risk of syphilis if that lady had the infection in the second stage. But honestly, I doubt she would be there giving you a handjob if she were at that point of the infection. The pain you feel can be because of the physical action of masturbating, if she did it strongly.
I don't see any risk and no test is needed.
All the best.