The World Chess Federation along with the International and National Olympic Committees all want everyone to play fair. They take extra measures to make sure the sport of chess is a fair and clean game upheld by the greatest integrity. They encourage and work to ensure the health of all their competitors. So, they do drug tests on players when they want to.
They accepted the World Anti-Doping Code and its International Standards. The spirit of sport is the essence of Olympism and is described as the celebration of the human body, spirit, and mind. It is characterized as the ethics, health, character, fun and joy, education, courage, self-respect, and so on of sports.
The World Chess Federation seek to uphold the spirit of sport, and by doing so, they do anti-doping tests. So, even if you play chess, and no physical sport, you’ll still be checked for drugs.