mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2025-04-20 08:16:38 +02:00
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
/*
|
|
* 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.
|
|
*/
|
|
|
|
/* eslint import/export: "off" */
|
|
|
|
import React from "react";
|
|
import { UIDReset } from "react-uid";
|
|
import { StaticRouter } from "react-router-dom";
|
|
import { render } from "@testing-library/react";
|
|
import PropTypes from "prop-types";
|
|
|
|
import { AlertContextMock } from "./alertContextMock";
|
|
import { CustomizationContextMock } from "./cutomizationContextMock";
|
|
|
|
Wrapper.propTypes = {
|
|
children: PropTypes.oneOfType([
|
|
PropTypes.arrayOf(PropTypes.node),
|
|
PropTypes.node,
|
|
]),
|
|
};
|
|
|
|
function Wrapper({ children }) {
|
|
return (
|
|
<CustomizationContextMock>
|
|
<AlertContextMock>
|
|
<StaticRouter>
|
|
<UIDReset>{children}</UIDReset>
|
|
</StaticRouter>
|
|
</AlertContextMock>
|
|
</CustomizationContextMock>
|
|
);
|
|
}
|
|
|
|
const customTestRender = (ui, options) =>
|
|
render(ui, { wrapper: Wrapper, ...options });
|
|
|
|
// re-export everything
|
|
export * from "@testing-library/react";
|
|
|
|
// override render method
|
|
export { customTestRender as render };
|