Open ilanbiala opened 9 years ago
Can you describe / give an example of what you want to achieve?
I'm trying to spy on a service method being called once something has happened in my controller, but every guide I have followed doesn't seem to work.
Testing with spies isn't really exclusive to angular, but it's probably a good idea to mention this. If you could break down your code into small pieces and post it here, I'll have look.
@Narretz this is one test where I can't seem to get the spy working.
$httpBackend
.expectPOST('/api/users/hasAccount')
.respond({
hasAccount: true,
pending: true
});
spyOn(MessageService, 'showFailureNotification').and.callThrough();
$scope.email = 'ibiala@ctemc.org';
$scope.authenticateOrRequestInvite();
expect(MessageService.showFailureNotification).toHaveBeenCalled();
I can't find any information about how to make sure methods are called in Angular-specific code via Jasmine spies. I've looked at the angular-seed, the unit and E2E test pages on angularjs.org, and in various other places, but they all have a different setup and most seem to fail now when actually trying them out.