-
-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unit testing models with associations/relationships fail #39
Comments
It's worth mentioning that there are no FIXTURES array defined for the models, since thus far testing I've done has been using an api-stub server in integration testing. Not sure if that's a contributing factor. |
You need to add moduleForModel('invoice', 'Invoice Model', {
needs: ["model:client"]
}); Also the naming convention is to specify the classes for the relationship with lowerCamelCase, so it's |
the "needs" model will by somewhat crippled though, since it wont be setup correctly. But it should work for simple unit tests. |
@pangratz Adding |
@pangratz Ah, I just saw your edit about naming conventions. I saw some example code that used TitleCase and that tripped me up. Changing to camelCase, so Thank you! |
**import { moduleForModel, test } from 'ember-qunit'; }); test('ordVal', function() {
assert.equal(ctrl.get('ordSide'),1,'should be 1'); This is my test code. I get following error when I run this. beforeEach failed on ordVal: WebSocketManager.default is not a constructor |
[ This refers to
v0.1.7
]When unit testing a model that makes use of
DS.belongsTo()
thecreateRecord()
fails with the following error:It appears that in order to create a record of a model, it expects its associated or related model to already exist. What's going on?
Here are the models and test
/app/models/client.js
:/app/models/invoice.js
:tests/models/invoice.js
:The text was updated successfully, but these errors were encountered: