Skip to content

Instantly share code, notes, and snippets.

@ksykulev
Last active August 29, 2015 14:12
Show Gist options
  • Save ksykulev/998583603bb8df423f81 to your computer and use it in GitHub Desktop.
Save ksykulev/998583603bb8df423f81 to your computer and use it in GitHub Desktop.
handleFindQuery
asyncTest("#handleFindQuery passing in associations", function() {
var name = 'banana',
users = FactoryGuy.buildList('user', 2, 'with_projects', { name: name });
testHelper.handleFindQuery('user', ['name'], users);
store.findQuery('user', {name: name}).then(function (users) {
//TypeError: Cannot read property 'typeKey' of undefined
//at Ember.Object.extend.modelFor (file:///Users/employee/projects/kys-ember-data-factory-guy/bower_components/ember-data/ember-data.js:11437:22)
start();
})
});
asyncTest("#handleFindQuery passing in associations", function() {
var name = 'banana',
company = FactoryGuy.make('company'),
users = [ FactoryGuy.make('user', { company: company.get('id'), name: name }) ];
testHelper.handleFindQuery('user', ['name'], users);
store.findQuery('user', {name: name}).then(function (users) {
//TypeError: Cannot read property 'typeKey' of undefined
//at Ember.Object.extend.modelFor (file:///Users/employee/projects/kys-ember-data-factory-guy/bower_components/ember-data/ember-data.js:11437:22)
start();
})
});
asyncTest("#handleFindQuery passing in associations", function() {
var name = 'banana',
company = FactoryGuy.make('company'),
users = [ FactoryGuy.build('user', { company: company.get('id'), name: name }) ];
testHelper.handleFindQuery('user', ['name'], users);
store.findQuery('user', {name: name}).then(function (users) {
//TypeError: Cannot read property 'typeKey' of undefined
//at Ember.Object.extend.modelFor (file:///Users/employee/projects/kys-ember-data-factory-guy/bower_components/ember-data/ember-data.js:11437:22)
start();
})
});
asyncTest("#handleFindQuery passing in associations", function() {
var name = 'banana',
company = FactoryGuy.make('company'),
users = [ FactoryGuy.build('user', { company_id: company.get('id'), name: name }) ];
testHelper.handleFindQuery('user', ['name'], users);
store.findQuery('user', {name: name}).then(function (users) {
equal(users.get('length'), 1);
equal(users.get('company.id'), company.get('id')); //company is not defined one user
start();
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment