Allah will keep testing His servants until the sincere believers can be clearly differentiated from the weak ones and the hypocrites. The children of Israel were weak and oppressed waiting for years for the help and mercy of Allah so when Allah drowned Fir’awan and his people to save them, the Children of Israel took the calf as God, forgot Allah and started worshiping it.
It’s clear from this, that whenever Allah deprives someone of something, it is only so that he can come closer to Him by ways of du’a and worship asking Allah to fulfill that need. And Allah finally fulfills that need according to his own timing, his own way, it’s so that the servant can rise in eeman and gratefulness. But then insan gets the name ‘insan’ due to his forgetful nature. So when there’s no longer a need that needs to be fulfilled, he forgets Allah’s favors, disobeys Him and gets involved in Shirk. Reflect over this…and correct your affairs.
-Lessons from Surah Al A’raf