Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit Testing Restangular - Unknown provider: RestangularProvider <- Restangular #177

Open
josoroma-zz opened this issue Oct 10, 2016 · 1 comment
Labels

Comments

@josoroma-zz
Copy link

josoroma-zz commented Oct 10, 2016

Hi!

I was wondering if you have ideas or examples on how to apply unit testing with Restangular:

FAILED TESTS:
  Home
    ✖ "before each" hook: workFn for "default component should be home"
      Chrome 53.0.2785 (Mac OS X 10.11.6)
    Error: [$injector:unpr] Unknown provider: RestangularProvider <- Restangular
    http://errors.angularjs.org/1.5.8/$injector/unpr?p0=RestangularProvider%20%3C-%20Restangular

Thanks in advance.

@josoroma-zz josoroma-zz changed the title Unit Testing Restangular Unit Testing Restangular - Unknown provider: RestangularProvider <- Restangular Oct 10, 2016
@fesor fesor added the question label Nov 28, 2016
@thematho
Copy link

Can you add your code as example? You only should need to import the module and then load it on beforeEach:

import ThirdPartyModule from 'angular-thirdparty';
import TestModule from './test';

describe('Some test', () => {
 // Modules import
  beforeEach(()=>{
    window.module(ThirdPartyModule );
    window.module(TestModule);
  });
});

I'm having troubles with ng-annotate and ES6 Classes though, I have to declare the controller/service as an array of dependencies and finally a function instead of a Class with ng-annotate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants