2023-02-09 05:02:40 +08:00
|
|
|
import app from '@flarum/core/src/forum/app';
|
|
|
|
import ForumApplication from '@flarum/core/src/forum/ForumApplication';
|
|
|
|
import jsYaml from 'js-yaml';
|
|
|
|
import fs from 'fs';
|
|
|
|
import jquery from 'jquery';
|
|
|
|
import m from 'mithril';
|
|
|
|
import flatten from 'flat';
|
2023-02-11 06:02:50 +08:00
|
|
|
import './test-matchers';
|
2023-02-09 05:02:40 +08:00
|
|
|
|
|
|
|
// Boot the Flarum app.
|
|
|
|
function bootApp() {
|
|
|
|
ForumApplication.prototype.mount = () => {};
|
|
|
|
window.flarum = { extensions: {} };
|
|
|
|
app.load({
|
|
|
|
apiDocument: null,
|
|
|
|
locale: 'en',
|
|
|
|
locales: {},
|
|
|
|
resources: [
|
|
|
|
{
|
|
|
|
type: 'forums',
|
|
|
|
id: '1',
|
|
|
|
attributes: {},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
session: {
|
|
|
|
userId: 0,
|
|
|
|
csrfToken: 'test',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
app.translator.addTranslations(flatten(jsYaml.load(fs.readFileSync('../locale/core.yml', 'utf8'))));
|
|
|
|
app.bootExtensions(window.flarum.extensions);
|
|
|
|
app.boot();
|
|
|
|
}
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
window.$ = jquery;
|
|
|
|
window.m = m;
|
|
|
|
|
|
|
|
bootApp();
|
|
|
|
});
|