It appears that store
is not available in my Ember tests, whether in the context of an ObjectController
or within 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:
Died on test #1 at test (
http://localhost:4200/assets/vendor.js:73539:13
) at eval (app/tests/unit/controllers/register-test.js:19:5) at requireModule (http://localhost:4200/assets/vendor.js:54:29
) athttp://localhost:4200/assets/test-loader.js:14:29
: Cannot read property 'createRecord' of null
Can anyone explain why I am not able to access DS
capabilities from either within my tests or from within the controller itself (when running tests)?