Unit test for component that created in ember engine


#1

Any one who has the experience for testing the file in ember engine?

I created a component in ember engine (in-repo-addon) via command: ember g component schedule-info --in-repo-addon engine-name.

this command will generate four files:

create lib/facility/addon/components/schedule-info.js

create lib/facility/addon/templates/components/schedule-info.hbs

create tests/integration/components/schedule-info-test.js

create lib/facility/app/components/schedule-info.js

and additional, I created a unit test file for this component and deleted the integration test file . Now I have a problem, that is when run test, I will see the message:

not ok 1 PhantomJS 2.1 - An Components | Unit | Component | schedule info “before each” hook for “should invoke all of the computed attributes for dropdown list” — message: > Attempting to register an unknown factory: ‘component:schedule-info’

Does anyone have resolved this problem?


#2

You need to test the component defined in an engine within that engine. Note that will not be run by default from outside the engine.

lib/facility/tests/…


#3

Thanks! This issue has been resolved by importing ‘ember-engines/test-support/engine-resolver-for’.