ember.js - Routine controller working but failing in test -
i'm building ember app ember-cli , reason mundane controller works @ runtime, fails when being run through tests following error:
typeerror: cannot read property 'find' of null
the controller nothing more than:
export default ember.arraycontroller.extend({ exercisetemplates: null, setup: function() { this.set('exercisetemplates', this.get('store').find('exercise-template')); }.on('init'), });
any ideas?
btw, here's stacktrace:
typeerror: cannot read property 'find' of null @ eval [as setup] (trainer/controllers/workouts.js:11:54) @ sendevent (http://localhost:4200/assets/vendor.js:27786:27) @ new class (http://localhost:4200/assets/vendor.js:47448:9) @ function.mixin.create.create (http://localhost:4200/assets/vendor.js:47903:16) @ object.defaultsubject [as subject] (http://localhost:4200/assets/test-support.js:200:22) @ object.context.(anonymous function) [as subject] (http://localhost:4200/assets/test-support.js:217:38) @ object.eval (trainer/tests/unit/controllers/workouts-test.js:15:29) @ object.wrapper (http://localhost:4200/assets/test-support.js:272:31) @ object.test.run (http://localhost:4200/assets/test-support.js:1084:18) @ http://localhost:4200/assets/test-support.js:11
the store
injected controllers this.store
- work if change code use this.store
instead of this.get('store')
?
update - trying provide more useful answer:
looking @ on of ember-data tests see there ds._setupcontainer
method. @givanse's comment above think adding following test setup might help:
var container = new ember.container(); ds._setupcontainer(container);
Comments
Post a Comment