mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 13:38:49 +08:00
21 lines
547 B
JavaScript
21 lines
547 B
JavaScript
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;
|
|
};
|