Skip to content

How to convert unit tests with injections? #64

@alexander-alvarez

Description

@alexander-alvarez

I have some injections on my controller (inside of an engine) which worked, but after running the codemod I'm getting errors:

Attempting to inject an unknown injection: 'router:main

I imagine it's because the registry in the new API is isolated?

Should we be manually registering services, or is there a different desired change?

const resolver = engineResolverFor('my-engine');

module('Unit | Controller | my controller', function(hooks) {
  setupTest(hooks, {
    resolver
  });

  test('injection of services', function(assert) {
      // error occurs here
      let controller = this.owner.factoryFor('controller:my-controller').create({});
    });

});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions