mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2024-12-25 00:11:36 +01:00
Set test modules.
This commit is contained in:
parent
19df5c2630
commit
39a8c16824
|
@ -22,10 +22,8 @@ export {ForisForm} from "form/components/ForisForm";
|
||||||
export {SubmitButton, STATES as SUBMIT_BUTTON_STATES} from "form/components/SubmitButton";
|
export {SubmitButton, STATES as SUBMIT_BUTTON_STATES} from "form/components/SubmitButton";
|
||||||
export {useForisModule, useForm} from "form/hooks";
|
export {useForisModule, useForm} from "form/hooks";
|
||||||
|
|
||||||
// // Test Utils
|
// Test Utils
|
||||||
export {render} from "testUtils/customTestRender";
|
|
||||||
export {mockedWS} from "testUtils/mockWS";
|
export {mockedWS} from "testUtils/mockWS";
|
||||||
export {setupGlobals} from "testUtils/setupGlobals";
|
|
||||||
|
|
||||||
|
|
||||||
// WebSockets
|
// WebSockets
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import {UIDReset} from 'react-uid';
|
import {UIDReset} from 'react-uid';
|
||||||
import {StaticRouter} from 'react-router';
|
|
||||||
import {render} from '@testing-library/react'
|
import {render} from '@testing-library/react'
|
||||||
|
|
||||||
Wrapper.propTypes = {
|
Wrapper.propTypes = {
|
||||||
|
@ -21,11 +20,9 @@ Wrapper.propTypes = {
|
||||||
};
|
};
|
||||||
|
|
||||||
function Wrapper({children}) {
|
function Wrapper({children}) {
|
||||||
return <StaticRouter>
|
return <UIDReset>
|
||||||
<UIDReset>
|
{children}
|
||||||
{children}
|
</UIDReset>
|
||||||
</UIDReset>
|
|
||||||
</StaticRouter>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const customTestRender = (ui, options) => render(ui, {wrapper: Wrapper, ...options});
|
const customTestRender = (ui, options) => render(ui, {wrapper: Wrapper, ...options});
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/)
|
|
||||||
*
|
|
||||||
* This is free software, licensed under the GNU General Public License v3.
|
|
||||||
* See /LICENSE for more information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Fake babel (gettext) used for docs
|
|
||||||
|
|
||||||
export function setupGlobals() {
|
|
||||||
global._ = str => str;
|
|
||||||
global.babel = {format: (str) => str};
|
|
||||||
global.ForisTranslations = {};
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user