Setting up scope in unit tests

Hi all!

I am starting to learn about testing to make my development process a bit more robust (and develop that much neglected habit).

In the Meteor-Angular tutorial, the first tests are introduced here (section 4.22). While I get what is being done in terms of the tests actually being run ( it('someTest', ...)), I do not quite grasp what is happening within this beforeEach:

beforeEach(() => {
    inject(($rootScope, $componentController) => {
        controller = $componentController(PartyAdd, {
            $scope: $rootScope.$new(true)
        });
    });
});

Can anyone give me a quick run-down? Also, where would I come across documentatio that would explain the concepts that this is based on so that I would have not need to ask this question?

I read the Meteor guide on testing and the Jasmine intro but couldn’t find any reference to something resembling the above there.

TIA!

So after some more searching I could find out that this is an Angular thing, and relevant documentation can be found here:

Where could I learn more about why this is necessary?