Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

Test fails for service generator #338

Closed
schickling opened this issue Aug 24, 2013 · 6 comments
Closed

Test fails for service generator #338

schickling opened this issue Aug 24, 2013 · 6 comments

Comments

@schickling
Copy link

If you want to create a service with e.g $ yo angular:service chineseRemainderTheorem a test file gets generated, in my case this one:

'use strict';

describe('Service: chineseRemainderTheorem', function () {

  // load the service's module
  beforeEach(module('algorithmsApp'));

  // instantiate service
  var chineseRemainderTheorem;
  beforeEach(inject(function (_chineseRemainderTheorem_) {
    chineseRemainderTheorem = _chineseRemainderTheorem_;
  }));

  it('should do something', function () {
    expect(!!chineseRemainderTheorem).toBe(true);
  });

});

The injection doesn't work out of the box because of _chineseRemainderTheorem_ so the tests fail

@eddiemonge
Copy link
Member

What do you mean? it looks right to me

@schickling
Copy link
Author

Well just try the following in a clean folder:

$ yo angular
$ grunt test # all green
$ yo angular:service testService
$ grunt test # damn!

@schickling
Copy link
Author

👍

@schickling
Copy link
Author

@eddiemonge @passy Unfortunately this issue isn't resolved for me yet. The casing of the class names differs from that one, that I entered. For example:

$ yo angular:service fixedPointIteration
'use strict';

angular.module('algorithmsApp')
  .service('Fixedpointiteration', function Fixedpointiteration() {
    // AngularJS will instantiate a singleton by calling "new" on this function
  });
'use strict';

describe('Service: fixedPointIteration', function () {

  // load the service's module
  beforeEach(module('algorithmsApp'));

  // instantiate service
  var fixedPointIteration;
  beforeEach(inject(function (_fixedPointIteration_) {
    fixedPointIteration = _fixedPointIteration_;
  }));

  it('should do something', function () {
    expect(!!fixedPointIteration).toBe(true);
  });

});

but should be:

'use strict';

angular.module('algorithmsApp')
  .service('FixedPointIteration', function FixedPointIteration() {
    // AngularJS will instantiate a singleton by calling "new" on this function
  });
'use strict';

describe('Service: FixedPointIteration', function () {

  // load the service's module
  beforeEach(module('algorithmsApp'));

  // instantiate service
  var fixedPointIteration;
  beforeEach(inject(function (FixedPointIteration) {
    fixedPointIteration = FixedPointIteration;
  }));

  it('should do something', function () {
    expect(!!fixedPointIteration).toBe(true);
  });

});

@eddiemonge
Copy link
Member

I see whats going on. Yeah it looks like an upstream issue. related to #301

@eddiemonge
Copy link
Member

can someone reopen this please?

stevemao pushed a commit to stevemao/generator-angular that referenced this issue Nov 6, 2014
* Configurable route base, defaults to `/api/`. This only affects the
  client URL, the backend code will still be written to `server/api`.

* Configurable pluralization of route, defaults to true.

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

Successfully merging a pull request may close this issue.

2 participants