# Unit test for component that created in ember engine

**URL:** <https://discuss.emberjs.com/t/unit-test-for-component-that-created-in-ember-engine/14139>\
**Category:** Testing\
**Created:** [January 16, 2018, 3:45pm UTC](https://discuss.emberjs.com/t/unit-test-for-component-that-created-in-ember-engine/14139 "2018-01-16T15:45:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![GregWang](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/gregwang/32/13186_2.png) [@GregWang](https://discuss.emberjs.com/u/GregWang)\
**Post date:** [January 16, 2018, 3:45pm UTC](https://discuss.emberjs.com/t/unit-test-for-component-that-created-in-ember-engine/14139/1 "2018-01-16T15:45:27Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Gaurav0](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/gaurav0/32/4704_2.png) [@Gaurav0](https://discuss.emberjs.com/u/Gaurav0)\
**Post date:** [January 17, 2018, 10:08pm UTC](https://discuss.emberjs.com/t/unit-test-for-component-that-created-in-ember-engine/14139/2 "2018-01-17T22:08:53Z")

</div>

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/…

---

<div class="post-metadata">

**Author:** ![GregWang](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/gregwang/32/13186_2.png) [@GregWang](https://discuss.emberjs.com/u/GregWang)\
**Post date:** [February 6, 2018, 3:21am UTC](https://discuss.emberjs.com/t/unit-test-for-component-that-created-in-ember-engine/14139/3 "2018-02-06T03:21:42Z")

</div>

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