jeudi 1 octobre 2015

findRecord giving error "Cannot read property '_internalModel' of undefined"

In our ember app, we are using following versions of ember-data and ember-data-factory-guy.

package.json

"ember-cli": "^1.13.8",
"ember-data": "1.13.9",
"ember-data-factory-guy": "1.13.10",

Note: we are using active-model adapter, not yet migrated to the json-api adapter.

import ActiveModelAdapter from 'active-model-adapter';
export default ActiveModelAdapter.extend({

Route: item.js

export default Ember.Route.extend(({
  model(params) {
    return this.store.findRecord('item', params.item_id);
  }
});

Its working fine in development mode, but while running test cases, am facing following issue:

Test Case for "display single item" fails with following error:

{
  "message": "Cannot read property '_internalModel' of undefined",
  "name": "TypeError"
}

ember-data/lib/system/stpre/finder.js, fails at return statement

return promise.then(function (adapterPayload) { Ember.assert("You made a request for a " + typeClass.typeClassKey + " with id " + id + ", but the adapter's response did not have any data", adapterPayload);

return store._adapterRun(function () {
  var requestType = get(serializer, 'isNewSerializerAPI') ? 'findRecord' : 'find';
  var payload = normalizeResponseHelper(serializer, store, typeClass, adapterPayload, id, requestType);
  //TODO Optimize
  var record = pushPayload(store, payload);
  return record._internalModel;
});

(http://ift.tt/1henvBR)

Are we missing anything here? Can anyone please help me to resolve this? I have tried by upgrading versions to latest, but still facing same issue.




Aucun commentaire:

Enregistrer un commentaire