discourse/test/javascripts/helpers/fixture-pretender.js

Failed to ignore revisions in .git-blame-ignore-revs.

21 lines
546 B
JavaScript
Raw Normal View History

export default function(helpers) {
const { response } = helpers;
const fixturesByUrl = {};
// Load any fixtures automatically
Object.keys(require._eak_seen).forEach(entry => {
if (/^fixtures/.test(entry)) {
const fixture = require(entry, null, null, true);
if (fixture && fixture.default) {
const obj = fixture.default;
Object.keys(obj).forEach(url => {
fixturesByUrl[url] = obj[url];
this.get(url, () => response(obj[url]));
});
}
}
});
return fixturesByUrl;
2018-06-15 23:03:24 +08:00
}