jeudi 4 avril 2019

Integration tests CRUD Ember.js

I need to do integration tests for my Ember app, for example in the user template :

<div class="container">

<h1> </h1>
<p>Age:  years old</p>
<p>Job: </p>
<img src="" alt="img" id="image">


</div>

I have to test that the list of users is correctly displayed. Is it possible to do so ?

I have never done that and I'm kind of lost here. Would it be something like :

test('it renders all users', function(assert) {
this.set('users', [
{ firstName: 'Tubby'},
{ firstName: 'Spot'},
{ firstName: 'Chester'},
{ firstName: 'Frisky'}
]);

 this.render(hbs``);
 assert.equal(this.$('.user').length, 4);
 });

Even though I read many articles about the integration tests, I still don't understand if it can be used for something that is not a component.

What about redirection ? Let's just say that I have to write an integration test that verifies that the redirection is okay. Can I do that with integration tests ?

Thanks for your help.




Aucun commentaire:

Enregistrer un commentaire