Reputation: 257
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
Upvotes: 0
Views: 227
Reputation: 12704
There is no first-class API for this in Mirage at the moment, though it is one of our top feature requests.
For now, you can use something like this to push some Mirage-created data into your Ember Data store.
Upvotes: 2