mardi 24 février 2015

'equal' is not defined : Ember-qunit does not seem to be importing

It appears the Qunit test methods aren't available even though I'm pretty sure I am importing them correctly.


I get the following errors:



unit/models/friend-test.js: line 11, col 3, 'ok' is not defined.
unit/models/friend-test.js: line 17, col 3, 'equal' is not defined.
unit/models/friend-test.js: line 23, col 3, 'equal' is not defined.
unit/models/friend-test.js: line 31, col 3, 'equal' is not defined.
unit/models/friend-test.js: line 32, col 3, 'equal' is not defined.


I have this test file unit/models/friend-test:



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


moduleForModel('friend', 'Friend', {
needs: ['model:article']
});

test('it exists', function() {
var model = this.subject();
ok(model);
});

test('fullName concats first and last name', function() {
var model = this.subject({firstName: 'Syd', lastName: 'Barrett'});

equal(model.get('fullName'), 'Syd Barrett');

Ember.run(function() {
model.set('firstName', 'Geddy');
});

equal(model.get('fullName'), 'Geddy Barrett', 'Updates fullName');
});

test('articles relationship', function() {
var klass = this.subject({}).constructor;

var relationship = Ember.get(klass, 'relationshipsByName').get('articles');

equal(relationship.key, 'articles');
equal(relationship.kind, 'hasMany');
});


I'm working through "Ember CLI 101"





Aucun commentaire:

Enregistrer un commentaire