lundi 28 janvier 2019

ember unit testing models

I am trying to write unit tests for my ember application. Currently the test that model exist works but I want to test computed properties within model which are based on some other properties generated by mirage or returned from API calls. My concern is how shall I initialize or populate data for the model under unit testing?

Sample unit test code for my model: "user" is:

import { moduleForModel, test } from 'ember-qunit';

moduleForModel('user', 'Unit | Model | User', {
    needs: ['model:account']
});

Now I want to write a test where I can use:

let model = this.subject();

And then I shall be able to access the properties injected by mirage. But how can I do that here? I did not find anything on documentation. Please help




Aucun commentaire:

Enregistrer un commentaire