mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2025-06-16 13:46:16 +02:00
Set modules.
This commit is contained in:
@ -1,11 +0,0 @@
|
||||
import * as customTestRender from "./customTestRender";
|
||||
import * as mockWS from "./mockWS";
|
||||
import * as setupGlobals from "./setupGlobals";
|
||||
import * as setupTest from "./setupTest";
|
||||
|
||||
export {
|
||||
customTestRender,
|
||||
mockWS,
|
||||
setupGlobals,
|
||||
setupTest,
|
||||
}
|
@ -6,6 +6,9 @@
|
||||
*/
|
||||
|
||||
// Fake babel (gettext) used for docs
|
||||
global._ = str => str;
|
||||
global.babel = {format: (str) => str};
|
||||
global.ForisTranslations = {};
|
||||
|
||||
export function setupGlobals() {
|
||||
global._ = str => str;
|
||||
global.babel = {format: (str) => str};
|
||||
global.ForisTranslations = {};
|
||||
}
|
||||
|
@ -5,33 +5,28 @@
|
||||
* See /LICENSE for more information.
|
||||
*/
|
||||
|
||||
import mockAxios from 'jest-mock-axios';
|
||||
import moment from 'moment-timezone';
|
||||
|
||||
export function setUpTest() {
|
||||
const mockAxios = require('jest-mock-axios');
|
||||
const moment = require('moment-timezone');
|
||||
// Setup axios cleanup
|
||||
global.afterEach(() => {
|
||||
mockAxios.reset();
|
||||
});
|
||||
|
||||
// Setup axios cleanup
|
||||
global.afterEach(() => {
|
||||
mockAxios.reset();
|
||||
});
|
||||
|
||||
// Mock babel (gettext)
|
||||
window._ = str => str;
|
||||
window.babel = {format: (str) => str};
|
||||
window.ForisTranslations = {};
|
||||
|
||||
// Mock scrollIntoView
|
||||
window.HTMLElement.prototype.scrollIntoView = () => {
|
||||
};
|
||||
|
||||
jest.doMock('moment', () => {
|
||||
moment.tz.setDefault('UTC');
|
||||
return moment;
|
||||
});
|
||||
|
||||
Date.now = jest.fn(() => new Date(Date.UTC(2019, 1, 1, 12, 13, 14)).valueOf());
|
||||
}
|
||||
// Mock babel (gettext)
|
||||
global._ = str => str;
|
||||
global.babel = {format: (str) => str};
|
||||
global.ForisTranslations = {};
|
||||
|
||||
// Mock scrollIntoView
|
||||
global.HTMLElement.prototype.scrollIntoView = () => {
|
||||
};
|
||||
|
||||
jest.doMock('moment', () => {
|
||||
moment.tz.setDefault('UTC');
|
||||
return moment;
|
||||
});
|
||||
|
||||
Date.now = jest.fn(() => new Date(Date.UTC(2019, 1, 1, 12, 13, 14)).valueOf());
|
||||
|
||||
jest.doMock("utils/vfs_fonts", () => ({}));
|
||||
|
Reference in New Issue
Block a user