Thank you for trusting your question to JA today. I am a licensed attorney with over a decade of law practice and over 20 years of experience in the legal field. I’m happy to be of assistance.
In employment law, in an "at will" employment situation, the employer can legally terminate your employment at any time, with or without cause. The employer doesn't need a legally valid reason, so the employer could have terminated you without the failed drug test and that would not have been "wrongful termination."
An employer can request a random drug test whenever they wish. You can certainly refuse, based on your not being on the clock, but then they could just have terminated you "at will."
Submitting to the drug test and failing it gave them a basis for termination, but they didn't legally need that basis, so on these facts you really have no argument of wrongful termination.
If you have any further questions, please let me know. I invite follow up questions, so use REPLY for those. If you have no further questions then good luck going forward and please do not forget to rate my service with a three, a four or preferably a five star rating so that I receive credit for working with you today. Please rate me based on my service and not on your satisfaction with the law, which I am not in control of and I am just reporting to you. Also, feel free to request me in the future, if you have questions concerning a different matter.