Integration test for component template


#1

I’m reatively new to front end testing in Ember so bear with me.

I have a template that I wrote a simple ‘it renders’ integration test for and am only getting about 23% test coverage on it. Specifically the buildFragment is not being covered. This component has an {{#unless}} block and several HTML elements. I’m not familiar with what the JS in a rendered template does so I’ve been rather lost.

Can anybody point me in the right direction or link to some articles that may help me understand a rendered template better and get this to 100% coverage?

Thank you


#2

The best starting point for me was the Ember Guides on component integration testing here in this guide you will learn how to test a component injecting your attributes and also interacting with actions inside the components.

To have good tests for your components you must design testable components here is a extremely good video on the best practices for creating components.