Wednesday 15 May 2013

ember.js - Ember QUnit moduleFor (testing) adapter retrieving Store -



ember.js - Ember QUnit moduleFor (testing) adapter retrieving Store -

i writing test custom ds.restadapter, uses our own sdk transporter instead of ajax calls. now, want test adapters find, findall, findquery ... functions require me pass instance of store parameter. example:

findall: function(store, type, sincetoken){...}

to able test this, need pass "store" param not available in modulefor in ember-qunit (unlike in moduleformodel can access store via this.store within test instance).

is there way gain access current instance of store?

thanks.

edit:

i solved creating mocks both, store , type. can create store instance by:

var store = ds.store.create({ adapter: @subject })

and mock type, ordinary object required properties test.

you can mock method (for instance, using sinon plugin qunit). solution accessing store (but i'm not sure work in case) helped me access store global namespace using setup , teardown methods:

setup: function () { ember.run(app, app.advancereadiness); }, teardown: function () { app.reset(); }

testing ember.js ember-cli ember-qunit

No comments:

Post a Comment