They could be smoking a joint once a week and growing their own.
At what point do we say that a poor person is spending too much on their own wants and not on their children's needs, and so cut off assistance? It's a devious issue because once you deny the person with the objectionable habit social assistance you are also denying their children the same assistance because of association. There isn't any good way to provide for the children without passing that assistance to their guardian. You could forcibly remove the children from that persons custody but doing so has some possibly severe consequences for the children psychologically, and physically, given the high rates of abuse in foster care and group homes.
In reality the lines can get very blurry and trying to define that line with a simple drug test is absurd. If it is actually a matter of saving kids then we need a much more indepth evaluation of each individual case probably by one or more social worker and possibly a couple lawyers and a judge. That all gets pretty expensive, even more expensive than the drug testing and of course begs for larger government. Which of course is why many of the folks pushing for drug testing of welfare recipients are just pushing for the tests. It allows for their expression of moral indignation with a relatively minor cost and no real positive impact, ignoring the fact that it's probably just cheapest and least harmful to not bother testing at all.