I have yeoman-angular set up with the following app:
angular.module('myApp', ['ngResource','ui.bootstrap'])
  .config(['$routeProvider', function ($routeProvider) {
      $routeProvider
      ...
  }]);
and a service:
angular.module('myApp')
  .factory('UserSvc', [function() {
        return {
            name : '',
            topicOrder: 'lec_type',
        };
    }]);
and the following test:
describe('Service: UserSvc', function () {
  beforeEach(module('mfApp'));
  var UserSvc;
  beforeEach(inject(function(_UserSvc_) {
    UserSvc = _UserSvc_;
  }));
  it('should do something', function () {
    expect(UserSvc.topicOrder).toEqual('lec_type');
  });
});
I've tried my best to inject $resource in the test (although the srvice itself isn't denpend on ngResource), but when I run the test, I get this error
Error: No module: ngResource
if I remove the dependencies from the module itself,
angular.module('myApp', [])
then the tests run successfully
I've really tried everything but failed
in your testacular.conf.js / karma.conf.js did you include angular-resource.js; e.g.
files = [
  JASMINE,
  JASMINE_ADAPTER,
  'app/vendor/angular/angular.js',
  'app/vendor/angular/angular-*.js',
                        After including your new component, remember to restart your Testacular/Karma session.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With