mirror of
https://github.com/flarum/framework.git
synced 2024-11-25 17:57:04 +08:00
7e6458a125
* feat(jest): create jest config package for unit testing * chore: housekeeping * fix: now we need to explicitly allow importing without extension * fix: recover EditorDriverInterface import * feat(jest): mithril component testing * fix: use separate `tsconfig.test.json` Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
41 lines
896 B
JavaScript
41 lines
896 B
JavaScript
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';
|
|
import './test-matchers';
|
|
|
|
// 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();
|
|
});
|