I am frustrated with my testing efforts thus far and am hoping someone can help.
I currently have a controller, LoginController, which depends on an authenticationSvc. Within the LoginController, there is a $scope.login function which passes a user object off to the authenticationSvc. That is the only code in the LoginController. I'm trying to verify that a 200 response is returned from a successful login. That's all I'm really trying to do, although eventually I would like to write an integration test that actually does login to the app and log out programmatically. Different topic, but if there are any good tools for that, I would be very interested. But back to the original problem. I'm using karma as my testing environment, mocha as my framework, and should as my assertion library. Currently I can get sanity "this should pass" and "this should fail" tests operating correctly. My very simple code is from a blog post <http://jasonmore.net/unit-testing-http-service-angular-js/>, but has been modified to call my authenticationSvc, and is as follows: describe('with httpBackend', function() { beforeEach(inject(function($controller, $rootScope, $httpBackend) { $scope = $rootScope.$new(); $httpBackend.when('POST', '/login') .respond({things: 'and stuff'}); MainCtrl = $controller('LoginController', { $scope: $scope }); $httpBackend.flush(); })); it('should set data to "things and stuff"', function() { expect($scope.data).toEqual({ things: 'and stuff' }); }); }); However, even though my karma.config.js file includes the declaration file of my LoginController, I'm experiencing the following error: Error: the object { "message": "[ng:areq] Argument 'LoginController' is not a function, got undefined What am I missing? Shouldn't this be easier? *bangs head against nearest wall* Thanks for any help you can offer. Cheers! Shawn -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.