Why did God let Satan test Job?
At the start of the book of Job, "the satan" appears among the sons of God and says Job is faithful only because he is rich and protected: "Doth Job fear God for nought?". God allows the test, first on his goods and children, then on his health, but forbids taking his life. The book does not explain suffering; it shows Job protesting and, at the end, God answering with the grandeur of creation.
In Job 1 and 2 the satan acts as an accuser in the heavenly court, not as an independent enemy: he can do only what God allows.
Job loses his oxen, sheep, camels, servants and ten children, and says: "The Lord gave, and the Lord hath taken away". Then he is struck with sores from head to foot and sits in ashes.
Three friends come to comfort him and insist he must have sinned; Job denies it and asks to speak with God.
God answers "out of the whirlwind" (chapters 38 to 41), asking where Job was when the earth was founded, and describes Behemoth and Leviathan. Job falls silent, God rebukes the friends and gives Job twice what he had.
The same structure, an evil being proposing to test a righteous man, appears in the Book of Jubilees, where Mastema suggests testing Abraham with Isaac.