From 39a8c16824b2ebb1db31bf409d7a7127baef6080 Mon Sep 17 00:00:00 2001 From: Bogdan Bodnar Date: Tue, 27 Aug 2019 14:07:34 +0200 Subject: [PATCH] Set test modules. --- src/index.js | 4 +--- src/testUtils/customTestRender.js | 9 +++------ src/testUtils/{setupTest.js => setup.js} | 0 src/testUtils/setupGlobals.js | 14 -------------- 4 files changed, 4 insertions(+), 23 deletions(-) rename src/testUtils/{setupTest.js => setup.js} (100%) delete mode 100644 src/testUtils/setupGlobals.js diff --git a/src/index.js b/src/index.js index a2840ed..ea1e5b9 100644 --- a/src/index.js +++ b/src/index.js @@ -22,10 +22,8 @@ export {ForisForm} from "form/components/ForisForm"; export {SubmitButton, STATES as SUBMIT_BUTTON_STATES} from "form/components/SubmitButton"; export {useForisModule, useForm} from "form/hooks"; -// // Test Utils -export {render} from "testUtils/customTestRender"; +// Test Utils export {mockedWS} from "testUtils/mockWS"; -export {setupGlobals} from "testUtils/setupGlobals"; // WebSockets diff --git a/src/testUtils/customTestRender.js b/src/testUtils/customTestRender.js index ee927de..35366d5 100644 --- a/src/testUtils/customTestRender.js +++ b/src/testUtils/customTestRender.js @@ -10,7 +10,6 @@ import React from 'react'; import PropTypes from 'prop-types'; import {UIDReset} from 'react-uid'; -import {StaticRouter} from 'react-router'; import {render} from '@testing-library/react' Wrapper.propTypes = { @@ -21,11 +20,9 @@ Wrapper.propTypes = { }; function Wrapper({children}) { - return - - {children} - - + return + {children} + } const customTestRender = (ui, options) => render(ui, {wrapper: Wrapper, ...options}); diff --git a/src/testUtils/setupTest.js b/src/testUtils/setup.js similarity index 100% rename from src/testUtils/setupTest.js rename to src/testUtils/setup.js diff --git a/src/testUtils/setupGlobals.js b/src/testUtils/setupGlobals.js deleted file mode 100644 index a4f96ee..0000000 --- a/src/testUtils/setupGlobals.js +++ /dev/null @@ -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 = {}; -}