January 2016
Intermediate to advanced
278 pages
4h 53m
English
The most basic test is to ensure that models and collections have the right properties set in order to prevent accidental changes in its properties. In the case of models, you can test the default values when a new contact is created and verify that the url attribute is right:
// spec/apps/contacts/models/contactSpec.js var Contact = require('../../../../app/js/apps/contacts/models/contact'); describe('Contact model', () => { describe('creating a new contact', () => { it('has the default values', () => { var contact = new Contact(); expect(contact.get('name')).toEqual(''); expect(contact.get('phone')).toEqual(''); expect(contact.get('email')).toEqual(''); expect(contact.get('address1')).toEqual(''); expect(contact.get('address2')).toEqual(''); ...Read now
Unlock full access