我有一个 ember.js 应用程序,我正在设置DS.Store
这样的应用程序(查看实际代码):
(function (app) {
'use strict';
...
var store = DS.Store.extend({
revision: 12
});
app.Store = store;
})(window.Balanced);
现在我有一个 qunit 测试,在那个测试中,我想将默认的 RESTAdapter 换成 FixtureAdapter,这样我就可以为我的模型设置夹具。我想我需要写这样的东西,但我不是 100% 确定:
(function () {
'use strict';
var fixtureAdapter;
module('tests.store.module', {
setup: function () {
fixtureAdapter = DS.FixtureAdapter.extend({
});
Balanced.Store.reopen({
adapter: fixtureAdapter
});
// TODO: how does this work?
Balanced.Marketplace.FIXTURES = [
{id: 1, name: '1'},
{id: 2, name: 'poop'},
{id: 3, name: 'poop'}
];
},
teardown: function () {
// teardown code
}
}
);
test("Marketplace query", function () {
var marketplaces = Balanced.Marketplace.find();
// TODO: how do I test this?
});
})();