They won’t waste one by testing it underground.
If that happens then Israel will have two things:
A bunch of enriched uranium to clean up;
All the proof they need to take out Iran's facilities (and some to spare).
The better use of nuclear weapons from Iran's perspective is blackmail and it is already working even without a test.