I'm new and doing my first Karma testing and have referred this post for $emit
test case. I have some trouble understanding the concept.
This is my code:
ctrl.toggleUserMode = function(pUserId, pUserName, userModeFlag) {
$scope.$emit('userModeToggleEvent', userModeFlag);
}
Sorry If my question seems silly. Can anyone explain what args
, MY_EVENT_ID
should I provide in the .toHaveBeenCalledWith
method.
spyOn(scope, "$emit") //run code to test expect(scope.$emit).toHaveBeenCalledWith("MY_EVENT_ID", other, possible, args);