Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

Spinner cannot be tested in generated application #34

Open
Max-Goebel opened this issue Jun 1, 2015 · 0 comments
Open

Spinner cannot be tested in generated application #34

Max-Goebel opened this issue Jun 1, 2015 · 0 comments

Comments

@Max-Goebel
Copy link

I performed these steps:

  1. Generating an application as described here: https://github.com/oasp/generator-oasp
  2. Installing the bower modules as described here: https://github.com/oasp/oasp4js-bower
  3. Adding the globalSpinner to the dependencies of app.controller.js:
angular.module('app.main').controller('AppCntl', function ($scope, globalSpinner) {
    'use strict';
    $scope.message = 'Hello!';
});

Now I can start gulp serve and the application works correctly. But unfortunately I'm not able to create a successful test against the controller.

Here is My first try:

beforeEach(inject(function ($rootScope, $controller, $q, $injector) {           
  $scope = $rootScope.$new();
  $controller('SearchACntl', {$scope: $scope});
};    
it('blabla',  function () {});

The restaurant application's testcases do not inject the globalSpinner explicitely, so I thaught this would not be necessary. But the result of gulp test:tdd is this:

PhantomJS 1.9.8 (Windows 7) Module: app.main, Controller: AppCntl blabla FAILED
Error: [$injector:unpr] Unknown provider: oasp.oaspUi.spinnerProvider <-
oasp.oaspUi.spinner

So I tried this:

    beforeEach(inject(function ($rootScope, $controller, $q, $injector) {           
        myGlobalSpinner = $injector.get('oasp.oaspUi.spinner');
        $scope = $rootScope.$new();
        $controller('SearchACntl', {$scope: $scope, globalSpinner : myGlobalSpinner});
    }));

The result is the same.

Question: Is it right that the bower modules are not loaded automatically when gulp test:tdd is executed? How can this be fixed?

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

No branches or pull requests

1 participant