February 2016
Beginner to intermediate
308 pages
5h 46m
English
When testing models, you can use Ember Data to help. In this recipe, we'll create a model and test to make sure that it's creating data correctly.
$ ember g model student.js
This will generate the necessary files for the student model.
// app/models/student.js
import DS from 'ember-data';
export default DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string')
});This model has two properties, firstName and lastName. Both hold string values.
// tests/unit/models/student-test.js import { moduleForModel, test } from 'ember-qunit'; moduleForModel('student', ...Read now
Unlock full access