It seems that store not available in my Ember tests, whether in the context of an ObjectController or as part of any unit tests. My unit test:
`import {test, moduleFor} from "ember-qunit"` `import DS from "ember-data"` moduleFor "controller:register", "RegisterController", { } test "store is working", -> expect 1 controller = @subject() Ember.run(-> sampleUser = controller.get("store").createRecord("user", { username: "myuser" password: "otherpassword" }) ok(sampleUser instanceof DS.Model) )
The test will give:
He died according to test No. 1 when testing ( http://localhost:4200/assets/vendor.js:73539:13 ) on eval (application / tests / block / controllers / register-test.js: 19: 5) in requireModule ( http://localhost:4200/assets/vendor.js:54:29 ) at http://localhost:4200/assets/test-loader.js:14:29 : Unable to read the 'createRecord' property from null
Can someone explain why I can not access the DS capabilities from my tests or from the controller itself (when running tests)?
source share