Akeidat Yitzchak: What was the Point?

Immediately (based on the progression of the verses) after Avraham makes a treaty with Avimelech, Avraham is told to sacrifice Yitzchak. What is the connection?

Child sacrifice is specifically prohibited by the Torah, how can Hashem command Avraham to sacrifice Yitzchak? Why did Hashem need to test Avraham and what is the purpose of a test?

Delivered at the OU Israel Center, November 14th, 2018 (6 Kislev 5779)