I have using Jasmine, Karma for writing unit test case. There is button for "create new user" link, If this button clicked it redirect to "/users/new". I want to check that whether this functionality works or not?
1 Answer
Karma and Jasmine are used for testing controller and service code only. Inside your unit tests you would call the code that is triggered by a button click event. You would then create a Jasmine Spy to spy on $state.go (assuming you are using ui-router) to check it was called with expected values.
If you want to test the actual button click then you need to use E2E (end to end) testing. You use protractor for this!