From 9e5b9433f8756db9978f139cbe6cea1808d89e72 Mon Sep 17 00:00:00 2001 From: Echo Date: Wed, 25 Jun 2025 13:20:11 +0200 Subject: [PATCH] [Glitch] Storybook Helpers Port c52848b444e368d38de4537eded1fc9c0950698b to glitch-soc, kinda Signed-off-by: Claire --- .../flavours/glitch/test_helpers.tsx | 60 ------------------- 1 file changed, 60 deletions(-) delete mode 100644 app/javascript/flavours/glitch/test_helpers.tsx diff --git a/app/javascript/flavours/glitch/test_helpers.tsx b/app/javascript/flavours/glitch/test_helpers.tsx deleted file mode 100644 index 09efda1e73..0000000000 --- a/app/javascript/flavours/glitch/test_helpers.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import PropTypes from 'prop-types'; -import type { PropsWithChildren } from 'react'; -import { Component } from 'react'; - -import { IntlProvider } from 'react-intl'; - -import { MemoryRouter } from 'react-router'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import { render as rtlRender } from '@testing-library/react'; - -class FakeIdentityWrapper extends Component< - PropsWithChildren<{ signedIn: boolean }> -> { - static childContextTypes = { - identity: PropTypes.shape({ - signedIn: PropTypes.bool.isRequired, - accountId: PropTypes.string, - disabledAccountId: PropTypes.string, - }).isRequired, - }; - - getChildContext() { - return { - identity: { - signedIn: this.props.signedIn, - accountId: '123', - }, - }; - } - - render() { - return this.props.children; - } -} - -function render( - ui: React.ReactElement, - { locale = 'en', signedIn = true, ...renderOptions } = {}, -) { - const Wrapper = (props: { children: React.ReactNode }) => { - return ( - - - - {props.children} - - - - ); - }; - return rtlRender(ui, { wrapper: Wrapper, ...renderOptions }); -} - -// re-export everything -// eslint-disable-next-line import/no-extraneous-dependencies -export * from '@testing-library/react'; - -// override render method -export { render };