Are We Tested or Punished Through Calamities?

How do we understand calamities? They say that one should never judge or try to draw conclusions about someone’s personal struggles in life based on their mere appearances, because no one besides Allah knows the truth and reality behind the facade of what appears on the surface of matters…