I am writing test for my custom DS.RESTAdapter, which uses our own SDK as transporter instead of ajax calls. Now, I want to test the adapters find, findAll, findQuery ... functions which require me to pass an instance of store as a parameter. For example:
findAll: function(store, type, sinceToken){...}
To be able to test this, i need to pass "store" param which is not available in moduleFor in ember-qunit (unlike in moduleForModel where you can access store via this.store within the test instance).
Is there another way to gain access to the current instance of store?
Thanks.
Edit:
I solved this by creating mocks for both, store and type. You can create a store instance by:
var store = DS.Store.create({
adapter: @subject
})
And a mock for type, just as an ordinary object with required properties for the test.
moduleFor
, but using justmodule
you should be able to access it from the app instance. You can useApp.__container__.lookup('store:main')
to get back the instance of the ember-data store. - jakecraige