Mold testing and prevention are done at the grower level. Here is a great article explaining things in detail.
https://www.healthline.com/nutrition/the-mycotoxins-in-coffee-myth?fbclid=IwAR0bRgsW-RV0d7R9IqJSCln0xby7fz9Htc3AMiGDI8gKlH5R0PjpzEnbBlM#coffee-content