When JS function use for the unit test, if that function gets data from enonic portal library, it gives null point exception. It seems we cannot read enonic portal library data when a function is use in the unit test.
Check if you can get the site itself. If not then it’s most likely a context issue. You should be inside correct context (Context Library - Enonic Developer Portal).
getSiteConfig() returns the site configuration for current application as JSON.
It means that in your test you should prepared all necessary data to make it workable. You can see how to do that in the links which I mentioned in my previous answer.
For example, suppose you have an application named myapplication, and the configuration for a site within this application looks like this: