You are right, God told Abraham his son would be the father of a great nation...(paraphrased) therefore even if he killed his son, God would raise him back up or else God would be a liar.
Yes, God examined Abraham’s heart and tested his faith. The Lord also provided the substitution for his son, Isaac, when God told Moses to stop. This has nothing to do with Abraham as a “psycho”, as some say.
It is also a beautiful prefiguration of Christ. Isaacs life was demanded by God, but God Himself provided the substitutionary sacrifice allowing Isaac to live. What a great picture of what He does for all of us.