I have a component test that is failing because it can't find a partial that the template is rendering. The specific error is "Assertion Failed: Unable to find partial with name 'components/activity-list-item-content'."
My test file is basically the default generated by ember-cli:
import {
moduleForComponent,
test
} from 'ember-qunit';
moduleForComponent('activity-list-item', 'ActivityListComponent', {
// specify the other units that are required for this test
needs: ['helper:format-date']
});
test('it renders', function() {
expect(2);
// creates the component instance
var component = this.subject();
equal(component._state, 'preRender');
// appends the component to the page
this.append();
equal(component._state, 'inDOM');
});
and the component template that looks like this:
{{#if activity.momentId}}
{{#link-to 'moment' momentId class='close-dropdown'}}
{{partial 'components/activity-list-item-content'}}
{{/link-to}}
{{else}}
{{partial 'components/activity-list-item-content'}}
{{/if}}
My application is working fine without any errors, so I'm wondering if it's something missing from my test setup. I've also tried adding it to the needs
array and get the same error:
needs: ['helper:format-date', 'template:components/-activity-list-item-content']
How do I get my tests to find the partial?
Update
@GJK pointed out that the partial name should start with an underscore instead of a dash. If I make that change, the test passes, however I get a depcrecation warning in the console that says:
DEPRECATION: Modules should not contain underscores. Attempted to lookup "myapp-ember/templates/components/-activity-list-item-content" which was not found. Please rename "myapp-ember/templates/components/_activity-list-item-content" to "myapp-ember/templates/components/-activity-list-item-content" instead.