Testing can be done to ensure no heavy metals/pesticide residues in the plant material.
Through testing the soil and/or plant material. Knowing where to harvest plants on land that haven’t been contaminated or cultivating one’s own using organic methods.