1
0
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:
Bogdan Bodnar
2019-08-27 11:54:57 +02:00
parent 7b38c1658c
commit 19df5c2630
53 changed files with 275 additions and 224 deletions

View File

@ -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,
}

View File

@ -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 = {};
}

View File

@ -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", () => ({}));