From 95dcce1684bc63ca7750ecff85b902e5e89714e3 Mon Sep 17 00:00:00 2001 From: mmv Date: Mon, 3 Jun 2019 17:17:10 +0400 Subject: [PATCH] replace internal react types --- src/components/Header/component/Layout.jsx | 4 ++-- src/components/Header/component/Provider.jsx | 4 ++-- src/components/Modal/index.jsx | 2 +- src/components/SharedSnackBar/index.jsx | 12 ++++++++++-- src/components/Stepper/OpenPaper/index.jsx | 4 ++-- src/components/Stepper/Step/index.jsx | 2 +- src/components/Stepper/index.jsx | 6 +++--- src/components/layout/Block/index.jsx | 2 +- src/components/layout/Bold/index.js | 2 +- src/components/layout/Col/index.jsx | 2 +- src/components/layout/Heading/index.jsx | 2 +- src/components/layout/Img/index.jsx | 2 +- src/components/layout/Link/index.jsx | 2 +- src/components/layout/Page/index.jsx | 2 +- src/components/layout/PageFrame/index.jsx | 2 +- src/components/layout/Paragraph/index.jsx | 2 +- src/components/layout/Pre/index.jsx | 2 +- src/components/layout/Row/index.jsx | 2 +- src/components/layout/Span/index.jsx | 2 +- src/components/layout/Table/index.jsx | 7 ++++--- src/routes/load/components/DetailsForm/index.jsx | 2 +- .../load/components/ReviewInformation/index.jsx | 2 +- .../open/components/ReviewInformation/index.jsx | 2 +- src/routes/open/components/SafeNameForm/index.jsx | 2 +- src/routes/open/components/SafeOwnersForm/index.jsx | 2 +- .../open/components/SafeThresholdForm/index.jsx | 2 +- .../safe/components/AddOwner/AddOwnerForm/index.jsx | 2 +- src/routes/safe/components/AddOwner/Review/index.jsx | 10 +++++++--- .../components/RemoveOwner/RemoveOwnerForm/index.jsx | 2 +- .../safe/components/RemoveOwner/Review/index.jsx | 6 ++++-- src/routes/safe/components/Safe/index.jsx | 2 +- .../safe/components/SendToken/ReviewTx/index.jsx | 2 +- .../components/SendToken/SendTokenForm/index.jsx | 6 ++++-- .../safe/components/Threshold/Review/index.jsx | 6 ++++-- .../components/Threshold/ThresholdForm/index.jsx | 6 ++++-- src/test/builder/safe.dom.builder.js | 2 +- src/test/builder/safe.dom.utils.js | 8 ++++---- src/test/safe.dom.create.test.js | 2 +- src/test/utils/Wrapper.jsx | 2 +- src/test/utils/logTransactions.js | 10 +++++----- src/test/utils/tokens/addToken.helper.js | 6 +++--- src/test/utils/transactions/addOwner.helper.js | 8 ++++---- src/test/utils/transactions/moveFunds.helper.js | 8 ++++---- src/test/utils/transactions/moveTokens.helper.js | 8 ++++---- src/test/utils/transactions/removeOwner.helper.js | 8 ++++---- src/test/utils/transactions/threshold.helper.js | 6 +++--- 46 files changed, 104 insertions(+), 83 deletions(-) diff --git a/src/components/Header/component/Layout.jsx b/src/components/Header/component/Layout.jsx index 7f474dba..cf2c8012 100644 --- a/src/components/Header/component/Layout.jsx +++ b/src/components/Header/component/Layout.jsx @@ -19,8 +19,8 @@ const logo = require('../assets/gnosis-safe-logo.svg') type Props = Open & { classes: Object, - providerDetails: React$Node, - providerInfo: React$Node, + providerDetails: React.Node, + providerInfo: React.Node, } const styles = () => ({ diff --git a/src/components/Header/component/Provider.jsx b/src/components/Header/component/Provider.jsx index bdaee353..76fd061f 100644 --- a/src/components/Header/component/Provider.jsx +++ b/src/components/Header/component/Provider.jsx @@ -10,8 +10,8 @@ import { sm, md } from '~/theme/variables' type Props = Open & { classes: Object, - popupDetails: React$Node, - info: React$Node, + popupDetails: React.Node, + info: React.Node, children: Function, } diff --git a/src/components/Modal/index.jsx b/src/components/Modal/index.jsx index 7818cc6c..c0b237dd 100644 --- a/src/components/Modal/index.jsx +++ b/src/components/Modal/index.jsx @@ -9,7 +9,7 @@ type Props = { description: string, open: boolean, handleClose: Function, - children: React$Node, + children: React.Node, classes: Object, modalClassName: ?string, paperClassName: ?string, diff --git a/src/components/SharedSnackBar/index.jsx b/src/components/SharedSnackBar/index.jsx index 1257c531..c208afdb 100644 --- a/src/components/SharedSnackBar/index.jsx +++ b/src/components/SharedSnackBar/index.jsx @@ -31,7 +31,15 @@ export const SharedSnackbar = () => ( ) -const SharedSnackbarContext = React.createContext({ +type SnackbarContext = { + openSnackbar: Function, + closeSnackbar: Function, + snackbarIsOpen: boolean, + message: string, + variant: string, +} + +const SharedSnackbarContext = React.createContext({ openSnackbar: undefined, closeSnackbar: undefined, snackbarIsOpen: false, @@ -40,7 +48,7 @@ const SharedSnackbarContext = React.createContext({ }) type Props = { - children: React$Node, + children: React.Node, } export type Variant = 'success' | 'error' | 'warning' | 'info' diff --git a/src/components/Stepper/OpenPaper/index.jsx b/src/components/Stepper/OpenPaper/index.jsx index 191a8b05..036214f8 100644 --- a/src/components/Stepper/OpenPaper/index.jsx +++ b/src/components/Stepper/OpenPaper/index.jsx @@ -21,8 +21,8 @@ const styles = () => ({ type Props = { classes: Object, - children: React$Node, - controls: React$Node, + children: React.Node, + controls: React.Node, container?: number, padding?: boolean, } diff --git a/src/components/Stepper/Step/index.jsx b/src/components/Stepper/Step/index.jsx index 3d766193..7a190928 100644 --- a/src/components/Stepper/Step/index.jsx +++ b/src/components/Stepper/Step/index.jsx @@ -2,7 +2,7 @@ import * as React from 'react' type Props = { - children: React$Node, + children: React.Node, } const Step = ({ children }: Props) => ( diff --git a/src/components/Stepper/index.jsx b/src/components/Stepper/index.jsx index 69e3c888..7d3de182 100644 --- a/src/components/Stepper/index.jsx +++ b/src/components/Stepper/index.jsx @@ -16,7 +16,7 @@ export { default as Step } from './Step' type Props = { steps: string[], onSubmit: (values: Object) => Promise, - children: React$Node, + children: React.Node, classes: Object, onReset?: () => void, initialValues?: Object, @@ -73,13 +73,13 @@ class GnoStepper extends React.PureComponent { })) } - getPageProps = (pages: React$Node): PageProps => { + getPageProps = (pages: React.Node): PageProps => { const { page } = this.state return React.Children.toArray(pages)[page].props } - getActivePageFrom = (pages: React$Node) => { + getActivePageFrom = (pages: React.Node) => { const activePageProps = this.getPageProps(pages) const { children, ...props } = activePageProps diff --git a/src/components/layout/Block/index.jsx b/src/components/layout/Block/index.jsx index 12e2702c..a0dd2f0c 100644 --- a/src/components/layout/Block/index.jsx +++ b/src/components/layout/Block/index.jsx @@ -11,7 +11,7 @@ type Props = { margin?: Size, padding?: Size, align?: 'center' | 'right' | 'left', - children: React$Node, + children: React.Node, className?: string, } diff --git a/src/components/layout/Bold/index.js b/src/components/layout/Bold/index.js index 70dc4d69..6bc6870d 100644 --- a/src/components/layout/Bold/index.js +++ b/src/components/layout/Bold/index.js @@ -2,7 +2,7 @@ import * as React from 'react' type Props = { - children: React$Node, + children: React.Node, } class Bold extends React.PureComponent { diff --git a/src/components/layout/Col/index.jsx b/src/components/layout/Col/index.jsx index 67c9782f..f09f2cac 100644 --- a/src/components/layout/Col/index.jsx +++ b/src/components/layout/Col/index.jsx @@ -27,7 +27,7 @@ type Props = { mdOffset?: number, lgOffset?: number, className?: string, - children: React$Node, + children: React.Node, } const Col = ({ diff --git a/src/components/layout/Heading/index.jsx b/src/components/layout/Heading/index.jsx index dd7de50d..576c8bcc 100644 --- a/src/components/layout/Heading/index.jsx +++ b/src/components/layout/Heading/index.jsx @@ -14,7 +14,7 @@ type Props = { color?: 'soft' | 'medium' | 'dark' | 'white' | 'fancy' | 'primary' | 'secondary' | 'warning' | 'disabled', tag: HeadingTag, truncate?: boolean, - children: React$Node, + children: React.Node, } class Heading extends React.PureComponent { diff --git a/src/components/layout/Img/index.jsx b/src/components/layout/Img/index.jsx index 895fe7b5..dd5886ff 100644 --- a/src/components/layout/Img/index.jsx +++ b/src/components/layout/Img/index.jsx @@ -10,7 +10,7 @@ type Props = { fullwidth?: boolean, bordered?: boolean, className?: string, - style?: React$Node, + style?: React.Node, } const Img = ({ diff --git a/src/components/layout/Link/index.jsx b/src/components/layout/Link/index.jsx index 08809997..54ec0bb1 100644 --- a/src/components/layout/Link/index.jsx +++ b/src/components/layout/Link/index.jsx @@ -10,7 +10,7 @@ const cx = classNames.bind(styles) type Props = { padding?: 'xs' | 'sm' | 'md', to: string, - children: React$Node, + children: React.Node, color?: 'regular' | 'white', className?: string, innerRef: React.ElementRef, diff --git a/src/components/layout/Page/index.jsx b/src/components/layout/Page/index.jsx index d0b45d9d..60efa927 100644 --- a/src/components/layout/Page/index.jsx +++ b/src/components/layout/Page/index.jsx @@ -6,7 +6,7 @@ import styles from './index.scss' const cx = classNames.bind(styles) type Props = { - children: React$Node, + children: React.Node, align?: 'center', overflow?: boolean } diff --git a/src/components/layout/PageFrame/index.jsx b/src/components/layout/PageFrame/index.jsx index f64c4de9..4b260890 100644 --- a/src/components/layout/PageFrame/index.jsx +++ b/src/components/layout/PageFrame/index.jsx @@ -6,7 +6,7 @@ import { SharedSnackbarProvider } from '~/components/SharedSnackBar' import styles from './index.scss' type Props = { - children: React$Node, + children: React.Node, } const PageFrame = ({ children }: Props) => ( diff --git a/src/components/layout/Paragraph/index.jsx b/src/components/layout/Paragraph/index.jsx index 5cbd9c7b..16478a7a 100644 --- a/src/components/layout/Paragraph/index.jsx +++ b/src/components/layout/Paragraph/index.jsx @@ -13,7 +13,7 @@ type Props = { size?: 'sm' | 'md' | 'lg' | 'xl' | 'xxl', color?: 'soft' | 'medium' | 'dark' | 'white' | 'fancy' | 'primary' | 'secondary' | 'warning' | 'disabled', transform?: 'capitalize' | 'lowercase' | 'uppercase', - children: React$Node, + children: React.Node, dot?: boolean, className?: string, } diff --git a/src/components/layout/Pre/index.jsx b/src/components/layout/Pre/index.jsx index 0736d6b8..a1d6375d 100644 --- a/src/components/layout/Pre/index.jsx +++ b/src/components/layout/Pre/index.jsx @@ -6,7 +6,7 @@ import styles from './index.scss' const cx = classNames.bind(styles) type Props = { - children: React$Node, + children: React.Node, } const Pre = ({ children, ...props }: Props) => ( diff --git a/src/components/layout/Row/index.jsx b/src/components/layout/Row/index.jsx index 2958bd00..7e6f27bf 100644 --- a/src/components/layout/Row/index.jsx +++ b/src/components/layout/Row/index.jsx @@ -8,7 +8,7 @@ const cx = classNames.bind(styles) type Props = { className?: string, - children: React$Node, + children: React.Node, margin?: 'xs' | 'sm' | 'md' | 'lg' | 'xl', align?: 'center' | 'end' | 'start', grow?: boolean, diff --git a/src/components/layout/Span/index.jsx b/src/components/layout/Span/index.jsx index fd8748ad..6196584b 100644 --- a/src/components/layout/Span/index.jsx +++ b/src/components/layout/Span/index.jsx @@ -2,7 +2,7 @@ import React, { PureComponent } from 'react' type Props = { - children: React$Node + children: React.Node } class Span extends PureComponent { diff --git a/src/components/layout/Table/index.jsx b/src/components/layout/Table/index.jsx index 6f23f532..886e9ee4 100644 --- a/src/components/layout/Table/index.jsx +++ b/src/components/layout/Table/index.jsx @@ -6,10 +6,12 @@ import TableCell from '@material-ui/core/TableCell' import TableHead from '@material-ui/core/TableHead' import TableRow from '@material-ui/core/TableRow' -export { TableBody, TableCell, TableHead, TableRow } +export { + TableBody, TableCell, TableHead, TableRow, +} type Props = { - children: React$Node, + children: React.Node, size?: number } @@ -35,4 +37,3 @@ const GnoTable = ({ size, children }: Props) => { } export default GnoTable - diff --git a/src/routes/load/components/DetailsForm/index.jsx b/src/routes/load/components/DetailsForm/index.jsx index 75d1efef..b80acc6f 100644 --- a/src/routes/load/components/DetailsForm/index.jsx +++ b/src/routes/load/components/DetailsForm/index.jsx @@ -116,7 +116,7 @@ const Details = ({ classes, errors }: Props) => ( const DetailsForm = withStyles(styles)(Details) -const DetailsPage = () => (controls: React$Node, { errors }: Object) => ( +const DetailsPage = () => (controls: React.Node, { errors }: Object) => ( diff --git a/src/routes/load/components/ReviewInformation/index.jsx b/src/routes/load/components/ReviewInformation/index.jsx index 645a064c..2dbff01e 100644 --- a/src/routes/load/components/ReviewInformation/index.jsx +++ b/src/routes/load/components/ReviewInformation/index.jsx @@ -138,7 +138,7 @@ class ReviewComponent extends React.PureComponent { const ReviewPage = withStyles(styles)(ReviewComponent) -const Review = ({ network, userAddress }: LayoutProps) => (controls: React$Node, { values }: Object) => ( +const Review = ({ network, userAddress }: LayoutProps) => (controls: React.Node, { values }: Object) => ( diff --git a/src/routes/open/components/ReviewInformation/index.jsx b/src/routes/open/components/ReviewInformation/index.jsx index 091c458b..36b424d8 100644 --- a/src/routes/open/components/ReviewInformation/index.jsx +++ b/src/routes/open/components/ReviewInformation/index.jsx @@ -155,7 +155,7 @@ const ReviewComponent = ({ values, classes, network }: Props) => { const ReviewPage = withStyles(styles)(ReviewComponent) -const Review = ({ network }: LayoutProps) => (controls: React$Node, { values }: Object) => ( +const Review = ({ network }: LayoutProps) => (controls: React.Node, { values }: Object) => ( diff --git a/src/routes/open/components/SafeNameForm/index.jsx b/src/routes/open/components/SafeNameForm/index.jsx index d0745973..055a7894 100644 --- a/src/routes/open/components/SafeNameForm/index.jsx +++ b/src/routes/open/components/SafeNameForm/index.jsx @@ -83,7 +83,7 @@ const SafeName = ({ classes }: Props) => ( const SafeNameForm = withStyles(styles)(SafeName) -const SafeNamePage = () => (controls: React$Node) => ( +const SafeNamePage = () => (controls: React.Node) => ( diff --git a/src/routes/open/components/SafeOwnersForm/index.jsx b/src/routes/open/components/SafeOwnersForm/index.jsx index eaaea059..8d3a6911 100644 --- a/src/routes/open/components/SafeOwnersForm/index.jsx +++ b/src/routes/open/components/SafeOwnersForm/index.jsx @@ -194,7 +194,7 @@ class SafeOwners extends React.Component { const SafeOwnersForm = withStyles(styles)(SafeOwners) -const SafeOwnersPage = ({ updateInitialProps }: Object) => (controls: React$Node, { values, errors }: Object) => ( +const SafeOwnersPage = ({ updateInitialProps }: Object) => (controls: React.Node, { values, errors }: Object) => ( { const SafeThresholdForm = withStyles(styles)(SafeThreshold) -const SafeOwnersPage = () => (controls: React$Node, { values }: Object) => ( +const SafeOwnersPage = () => (controls: React.Node, { values }: Object) => ( diff --git a/src/routes/safe/components/AddOwner/AddOwnerForm/index.jsx b/src/routes/safe/components/AddOwner/AddOwnerForm/index.jsx index 0171bebf..b756f2d3 100644 --- a/src/routes/safe/components/AddOwner/AddOwnerForm/index.jsx +++ b/src/routes/safe/components/AddOwner/AddOwnerForm/index.jsx @@ -32,7 +32,7 @@ type Props = { addresses: string[], } -const AddOwnerForm = ({ addresses, numOwners, threshold }: Props) => (controls: React$Node) => ( +const AddOwnerForm = ({ addresses, numOwners, threshold }: Props) => (controls: React.Node) => ( Add Owner diff --git a/src/routes/safe/components/AddOwner/Review/index.jsx b/src/routes/safe/components/AddOwner/Review/index.jsx index d352a1c1..4ce516ad 100644 --- a/src/routes/safe/components/AddOwner/Review/index.jsx +++ b/src/routes/safe/components/AddOwner/Review/index.jsx @@ -17,7 +17,7 @@ const spinnerStyle = { minHeight: '50px', } -const Review = () => (controls: React$Node, { values, submitting }: FormProps) => { +const Review = () => (controls: React.Node, { values, submitting }: FormProps) => { const text = values[INCREASE_PARAM] ? 'This operation will increase the threshold of the safe' : 'This operation will not modify the threshold of the safe' @@ -26,10 +26,14 @@ const Review = () => (controls: React$Node, { values, submitting }: FormProps) = Review the Add Owner operation - Owner Name: {values[NAME_PARAM]} + Owner Name: + {' '} + {values[NAME_PARAM]} - Owner Address: {values[OWNER_ADDRESS_PARAM]} + Owner Address: + {' '} + {values[OWNER_ADDRESS_PARAM]} {text} diff --git a/src/routes/safe/components/RemoveOwner/RemoveOwnerForm/index.jsx b/src/routes/safe/components/RemoveOwner/RemoveOwnerForm/index.jsx index 12264999..5f1a61a4 100644 --- a/src/routes/safe/components/RemoveOwner/RemoveOwnerForm/index.jsx +++ b/src/routes/safe/components/RemoveOwner/RemoveOwnerForm/index.jsx @@ -20,7 +20,7 @@ type Props = { const RemoveOwnerForm = ({ numOwners, threshold, name, disabled, pendingTransactions, }: Props) => ( - controls: React$Node, + controls: React.Node, ) => ( diff --git a/src/routes/safe/components/RemoveOwner/Review/index.jsx b/src/routes/safe/components/RemoveOwner/Review/index.jsx index 63b0b9a7..f9e35c2d 100644 --- a/src/routes/safe/components/RemoveOwner/Review/index.jsx +++ b/src/routes/safe/components/RemoveOwner/Review/index.jsx @@ -21,7 +21,7 @@ const spinnerStyle = { minHeight: '50px', } -const Review = ({ name }: Props) => (controls: React$Node, { values, submitting }: FormProps) => { +const Review = ({ name }: Props) => (controls: React.Node, { values, submitting }: FormProps) => { const text = values[DECREASE_PARAM] ? 'This operation will decrease the threshold of the safe' : 'This operation will not modify the threshold of the safe' @@ -30,7 +30,9 @@ const Review = ({ name }: Props) => (controls: React$Node, { values, submitting Review the Remove Owner operation - Owner Name: {name} + Owner Name: + {' '} + {name} {text} diff --git a/src/routes/safe/components/Safe/index.jsx b/src/routes/safe/components/Safe/index.jsx index 2399ff89..23af1114 100644 --- a/src/routes/safe/components/Safe/index.jsx +++ b/src/routes/safe/components/Safe/index.jsx @@ -32,7 +32,7 @@ type SafeProps = { } type State = { - component?: React$Node, + component?: React.Node, } const listStyle = { diff --git a/src/routes/safe/components/SendToken/ReviewTx/index.jsx b/src/routes/safe/components/SendToken/ReviewTx/index.jsx index 15f3ef92..e2a41932 100644 --- a/src/routes/safe/components/SendToken/ReviewTx/index.jsx +++ b/src/routes/safe/components/SendToken/ReviewTx/index.jsx @@ -21,7 +21,7 @@ const spinnerStyle = { minHeight: '50px', } -const ReviewTx = ({ symbol }: Props) => (controls: React$Node, { values, submitting }: FormProps) => ( +const ReviewTx = ({ symbol }: Props) => (controls: React.Node, { values, submitting }: FormProps) => ( Review the move token funds diff --git a/src/routes/safe/components/SendToken/SendTokenForm/index.jsx b/src/routes/safe/components/SendToken/SendTokenForm/index.jsx index d9891207..1095a7fe 100644 --- a/src/routes/safe/components/SendToken/SendTokenForm/index.jsx +++ b/src/routes/safe/components/SendToken/SendTokenForm/index.jsx @@ -2,7 +2,9 @@ import * as React from 'react' import Field from '~/components/forms/Field' import TextField from '~/components/forms/TextField' -import { composeValidators, inLimit, mustBeFloat, required, greaterThan, mustBeEthereumAddress } from '~/components/forms/validator' +import { + composeValidators, inLimit, mustBeFloat, required, greaterThan, mustBeEthereumAddress, +} from '~/components/forms/validator' import Block from '~/components/layout/Block' import OpenPaper from '~/components/Stepper/OpenPaper' import Heading from '~/components/layout/Heading' @@ -17,7 +19,7 @@ type Props = { symbol: string, } -const SendTokenForm = ({ funds, symbol }: Props) => (controls: React$Node) => ( +const SendTokenForm = ({ funds, symbol }: Props) => (controls: React.Node) => ( Send tokens Transaction diff --git a/src/routes/safe/components/Threshold/Review/index.jsx b/src/routes/safe/components/Threshold/Review/index.jsx index 429e939a..459ca795 100644 --- a/src/routes/safe/components/Threshold/Review/index.jsx +++ b/src/routes/safe/components/Threshold/Review/index.jsx @@ -17,11 +17,13 @@ const spinnerStyle = { minHeight: '50px', } -const Review = () => (controls: React$Node, { values, submitting }: FormProps) => ( +const Review = () => (controls: React.Node, { values, submitting }: FormProps) => ( Review the Threshold operation - The new threshold will be: {values[THRESHOLD_PARAM]} + The new threshold will be: + {' '} + {values[THRESHOLD_PARAM]} { submitting && } diff --git a/src/routes/safe/components/Threshold/ThresholdForm/index.jsx b/src/routes/safe/components/Threshold/ThresholdForm/index.jsx index c1d4b9fd..9c6b14b5 100644 --- a/src/routes/safe/components/Threshold/ThresholdForm/index.jsx +++ b/src/routes/safe/components/Threshold/ThresholdForm/index.jsx @@ -5,7 +5,9 @@ import Heading from '~/components/layout/Heading' import OpenPaper from '~/components/Stepper/OpenPaper' import Field from '~/components/forms/Field' import TextField from '~/components/forms/TextField' -import { composeValidators, minValue, maxValue, mustBeInteger, required } from '~/components/forms/validator' +import { + composeValidators, minValue, maxValue, mustBeInteger, required, +} from '~/components/forms/validator' import { type Safe } from '~/routes/safe/store/models/safe' export const THRESHOLD_PARAM = 'threshold' @@ -15,7 +17,7 @@ type ThresholdProps = { safe: Safe, } -const ThresholdForm = ({ numOwners, safe }: ThresholdProps) => (controls: React$Node) => ( +const ThresholdForm = ({ numOwners, safe }: ThresholdProps) => (controls: React.Node) => ( {'Change safe\'s threshold'} diff --git a/src/test/builder/safe.dom.builder.js b/src/test/builder/safe.dom.builder.js index 0526c272..89c61b6f 100644 --- a/src/test/builder/safe.dom.builder.js +++ b/src/test/builder/safe.dom.builder.js @@ -13,7 +13,7 @@ import { MOVE_FUNDS_BUTTON_TEXT } from '~/routes/safe/components/Safe/BalanceInf export type DomSafe = { address: string, safeButtons: Element[], - safe: React$Component, + safe: React.Component, accounts: string[], store: Store, } diff --git a/src/test/builder/safe.dom.utils.js b/src/test/builder/safe.dom.utils.js index 7f5315f9..86f5564b 100644 --- a/src/test/builder/safe.dom.utils.js +++ b/src/test/builder/safe.dom.utils.js @@ -33,7 +33,7 @@ export const listTxsClickingOn = async (store: Store, seeTxsButton: Element, saf await sleep(800) } -export const checkMinedTx = (Transaction: React$Component, name: string) => { +export const checkMinedTx = (Transaction: React.Component, name: string) => { const paragraphs = TestUtils.scryRenderedDOMComponentsWithTag(Transaction, 'p') const status = 'Already executed' @@ -49,9 +49,9 @@ export const checkMinedTx = (Transaction: React$Component, name: strin expect(hashParagraph).toContain(EMPTY_DATA) } -export const getListItemsFrom = (Transaction: React$Component) => TestUtils.scryRenderedComponentsWithType(Transaction, ListItemText) +export const getListItemsFrom = (Transaction: React.Component) => TestUtils.scryRenderedComponentsWithType(Transaction, ListItemText) -export const expand = async (Transaction: React$Component) => { +export const expand = async (Transaction: React.Component) => { const listItems = getListItemsFrom(Transaction) if (listItems.length > 4) { return @@ -68,7 +68,7 @@ export const expand = async (Transaction: React$Component) => { } export const checkPendingTx = async ( - Transaction: React$Component, + Transaction: React.Component, safeThreshold: number, name: string, statusses: string[], diff --git a/src/test/safe.dom.create.test.js b/src/test/safe.dom.create.test.js index a830e78a..d85ab252 100644 --- a/src/test/safe.dom.create.test.js +++ b/src/test/safe.dom.create.test.js @@ -101,7 +101,7 @@ const deploySafe = async (createSafeForm: any, threshold: number, numOwners: num } const aDeployedSafe = async (specificStore: Store, threshold?: number = 1, numOwners?: number = 1) => { - const safe: React$Component<{}> = await renderOpenSafeForm(specificStore) + const safe: React.Component<{}> = await renderOpenSafeForm(specificStore) const safeAddress = await deploySafe(safe, threshold, numOwners) return safeAddress diff --git a/src/test/utils/Wrapper.jsx b/src/test/utils/Wrapper.jsx index b76cc665..7f31f0cb 100644 --- a/src/test/utils/Wrapper.jsx +++ b/src/test/utils/Wrapper.jsx @@ -2,7 +2,7 @@ import * as React from 'react' type WrapperProps = { - children: React$Node, + children: React.Node, } const Wrapper = ({ children }: WrapperProps) => {children} diff --git a/src/test/utils/logTransactions.js b/src/test/utils/logTransactions.js index 433ea17d..a3e7f3be 100644 --- a/src/test/utils/logTransactions.js +++ b/src/test/utils/logTransactions.js @@ -37,7 +37,7 @@ type FinsihedTx = { finishedTransaction: boolean, } -export const whenExecuted = (SafeDom: React$Component, ParentComponent: React$ElementType): Promise => new Promise((resolve, reject) => { +export const whenExecuted = (SafeDom: React.Component, ParentComponent: React.ElementType): Promise => new Promise((resolve, reject) => { let times = 0 const interval = setInterval(() => { if (times >= MAX_TIMES_EXECUTED) { @@ -47,7 +47,7 @@ export const whenExecuted = (SafeDom: React$Component, ParentComponent // $FlowFixMe const SafeComponent = TestUtils.findRenderedComponentWithType(SafeDom, ParentComponent) - type GnoStepperType = React$Component + type GnoStepperType = React.Component // $FlowFixMe const StepperComponent: GnoStepperType = TestUtils.findRenderedComponentWithType(SafeComponent, GnoStepper) @@ -64,8 +64,8 @@ type MiddleStep = { } export const whenOnNext = ( - SafeDom: React$Component, - ParentComponent: React$ElementType, + SafeDom: React.Component, + ParentComponent: React.ElementType, position: number, ): Promise => new Promise((resolve, reject) => { let times = 0 @@ -77,7 +77,7 @@ export const whenOnNext = ( // $FlowFixMe const SafeComponent = TestUtils.findRenderedComponentWithType(SafeDom, ParentComponent) - type StepperType = React$Component + type StepperType = React.Component // $FlowFixMe const StepperComponent: StepperType = TestUtils.findRenderedComponentWithType(SafeComponent, Stepper) if (StepperComponent.props.activeStep === position) { diff --git a/src/test/utils/tokens/addToken.helper.js b/src/test/utils/tokens/addToken.helper.js index 922a1b9a..f723b4e4 100644 --- a/src/test/utils/tokens/addToken.helper.js +++ b/src/test/utils/tokens/addToken.helper.js @@ -4,14 +4,14 @@ import * as TestUtils from 'react-dom/test-utils' import AddToken from '~/logic/tokens/component/AddToken' import { whenOnNext, whenExecuted } from '~/test/utils/logTransactions' -export const clickOnAddToken = async (TokensDom: React$Component) => { +export const clickOnAddToken = async (TokensDom: React.Component) => { const buttons = TestUtils.scryRenderedDOMComponentsWithTag(TokensDom, 'button') expect(buttons.length).toBe(1) TestUtils.Simulate.click(buttons[0]) await sleep(400) } -export const fillAddress = async (TokensDom: React$Component, secondErc20Token: any) => { +export const fillAddress = async (TokensDom: React.Component, secondErc20Token: any) => { // fill the form const AddTokenComponent = TestUtils.findRenderedComponentWithType(TokensDom, AddToken) if (!AddTokenComponent) throw new Error() @@ -28,7 +28,7 @@ export const fillAddress = async (TokensDom: React$Component, secondEr return whenOnNext(TokensDom, AddToken, 1) } -export const fillHumanReadableInfo = async (TokensDom: React$Component) => { +export const fillHumanReadableInfo = async (TokensDom: React.Component) => { // fill the form const AddTokenComponent = TestUtils.findRenderedComponentWithType(TokensDom, AddToken) if (!AddTokenComponent) throw new Error() diff --git a/src/test/utils/transactions/addOwner.helper.js b/src/test/utils/transactions/addOwner.helper.js index 1361ee21..fe038f3d 100644 --- a/src/test/utils/transactions/addOwner.helper.js +++ b/src/test/utils/transactions/addOwner.helper.js @@ -6,8 +6,8 @@ import { whenExecuted } from '~/test/utils/logTransactions' import AddOwner from '~/routes/safe/components/AddOwner' export const sendAddOwnerForm = async ( - SafeDom: React$Component, - addOwner: React$Component, + SafeDom: React.Component, + addOwner: React.Component, ownerName: string, ownerAddress: string, increase: boolean = false, @@ -39,12 +39,12 @@ export const sendAddOwnerForm = async ( return whenExecuted(SafeDom, AddOwner) } -export const checkMinedAddOwnerTx = (Transaction: React$Component, name: string) => { +export const checkMinedAddOwnerTx = (Transaction: React.Component, name: string) => { checkMinedTx(Transaction, name) } export const checkPendingAddOwnerTx = async ( - Transaction: React$Component, + Transaction: React.Component, safeThreshold: number, name: string, statusses: string[], diff --git a/src/test/utils/transactions/moveFunds.helper.js b/src/test/utils/transactions/moveFunds.helper.js index 7024d204..2ceb679d 100644 --- a/src/test/utils/transactions/moveFunds.helper.js +++ b/src/test/utils/transactions/moveFunds.helper.js @@ -6,8 +6,8 @@ import SendToken from '~/routes/safe/components/SendToken' import { whenExecuted } from '~/test/utils/logTransactions' export const sendMoveFundsForm = async ( - SafeDom: React$Component, - expandBalance: React$Component, + SafeDom: React.Component, + expandBalance: React.Component, value: string, destination: string, ) => { @@ -38,12 +38,12 @@ export const sendMoveFundsForm = async ( return whenExecuted(SafeDom, SendToken) } -export const checkMinedMoveFundsTx = (Transaction: React$Component, name: string) => { +export const checkMinedMoveFundsTx = (Transaction: React.Component, name: string) => { checkMinedTx(Transaction, name) } export const checkPendingMoveFundsTx = async ( - Transaction: React$Component, + Transaction: React.Component, safeThreshold: number, name: string, statusses: string[], diff --git a/src/test/utils/transactions/moveTokens.helper.js b/src/test/utils/transactions/moveTokens.helper.js index 9104aba2..b3b8ed1f 100644 --- a/src/test/utils/transactions/moveTokens.helper.js +++ b/src/test/utils/transactions/moveTokens.helper.js @@ -11,8 +11,8 @@ import addTokens from '~/logic/tokens/store/actions/saveTokens' import { calculateBalanceOf } from '~/routes/safe/store/actions/fetchTokenBalances' export const sendMoveTokensForm = async ( - SafeDom: React$Component, - expandBalance: React$Component, + SafeDom: React.Component, + expandBalance: React.Component, value: number, destination: string, ) => { @@ -64,12 +64,12 @@ export const dispatchTknBalance = async (store: Store, tokenAddress: string, add fetchBalancesMock.mockRestore() } -export const checkMinedMoveTokensTx = (Transaction: React$Component, name: string) => { +export const checkMinedMoveTokensTx = (Transaction: React.Component, name: string) => { checkMinedTx(Transaction, name) } export const checkPendingMoveTokensTx = async ( - Transaction: React$Component, + Transaction: React.Component, safeThreshold: number, name: string, statusses: string[], diff --git a/src/test/utils/transactions/removeOwner.helper.js b/src/test/utils/transactions/removeOwner.helper.js index c09c0548..41944828 100644 --- a/src/test/utils/transactions/removeOwner.helper.js +++ b/src/test/utils/transactions/removeOwner.helper.js @@ -7,8 +7,8 @@ import { whenExecuted } from '~/test/utils/logTransactions' import RemoveOwner from '~/routes/safe/components/RemoveOwner' export const sendRemoveOwnerForm = async ( - SafeDom: React$Component, - expandOwners: React$Component, + SafeDom: React.Component, + expandOwners: React.Component, ) => { // Expand owners TestUtils.Simulate.click(expandOwners) @@ -34,12 +34,12 @@ export const sendRemoveOwnerForm = async ( return whenExecuted(SafeDom, RemoveOwner) } -export const checkMinedRemoveOwnerTx = (Transaction: React$Component, name: string) => { +export const checkMinedRemoveOwnerTx = (Transaction: React.Component, name: string) => { checkMinedTx(Transaction, name) } export const checkPendingRemoveOwnerTx = async ( - Transaction: React$Component, + Transaction: React.Component, safeThreshold: number, name: string, statusses: string[], diff --git a/src/test/utils/transactions/threshold.helper.js b/src/test/utils/transactions/threshold.helper.js index 79663fa3..6a6c39e2 100644 --- a/src/test/utils/transactions/threshold.helper.js +++ b/src/test/utils/transactions/threshold.helper.js @@ -7,8 +7,8 @@ import Threshold from '~/routes/safe/components/Threshold' import { whenExecuted } from '~/test/utils/logTransactions' export const sendChangeThresholdForm = async ( - SafeDom: React$Component, - changeThreshold: React$Component, + SafeDom: React.Component, + changeThreshold: React.Component, threshold: string, ) => { // Load the Threshold Form @@ -29,7 +29,7 @@ export const sendChangeThresholdForm = async ( return whenExecuted(SafeDom, Threshold) } -export const checkMinedThresholdTx = (Transaction: React$Component, name: string) => { +export const checkMinedThresholdTx = (Transaction: React.Component, name: string) => { checkMinedTx(Transaction, name) }