diff --git a/src/routes/safeList/components/Layout.stories.js b/src/routes/safeList/components/Layout.stories.js
index 40a8630d..d8189180 100644
--- a/src/routes/safeList/components/Layout.stories.js
+++ b/src/routes/safeList/components/Layout.stories.js
@@ -3,7 +3,6 @@ import { storiesOf } from '@storybook/react'
import { List } from 'immutable'
import * as React from 'react'
import styles from '~/components/layout/PageFrame/index.scss'
-import { SafeFactory } from '~/routes/safe/store/test/builder/safe.builder'
import Component from './Layout'
const FrameDecorator = story =>
{story()}
@@ -12,7 +11,3 @@ storiesOf('Routes /safes', module)
.addDecorator(FrameDecorator)
.add('Safe List whithout safes and connected', () => )
.add('Safe List whithout safes and NOT connected', () => )
- .add('Safe List whith 2 safes', () => {
- const safes = List([SafeFactory.oneOwnerSafe(), SafeFactory.twoOwnersSafe()])
- return
- })
diff --git a/src/routes/safeList/store/test/safeList.spec.js b/src/routes/safeList/store/test/safeList.spec.js
deleted file mode 100644
index 8d329042..00000000
--- a/src/routes/safeList/store/test/safeList.spec.js
+++ /dev/null
@@ -1,7 +0,0 @@
-// @flow
-import safesSelectorTests from './safes.selector'
-
-describe('SafeList Test suite', () => {
- // safesSelector SELECTOR
- safesSelectorTests()
-})
diff --git a/src/routes/safeList/store/test/safes.selector.js b/src/routes/safeList/store/test/safes.selector.js
deleted file mode 100644
index 3a128f71..00000000
--- a/src/routes/safeList/store/test/safes.selector.js
+++ /dev/null
@@ -1,122 +0,0 @@
-// @flow
-import { List, Map } from 'immutable'
-import { SAFE_REDUCER_ID } from '~/routes/safe/store/reducer/safe'
-import { type Safe } from '~/routes/safe/store/models/safe'
-import { getProviderInfo } from '~/logic/wallets/getWeb3'
-import { SafeFactory } from '~/routes/safe/store/test/builder/safe.builder'
-import { PROVIDER_REDUCER_ID } from '~/logic/wallets/store/reducer/provider'
-import { makeProvider, type Provider } from '~/logic/wallets/store/model/provider'
-import { safesByOwnerSelector } from '../selectors'
-
-const safesListSelectorTests = () => {
- let walletRecord: Provider
- beforeEach(async () => {
- const provider = await getProviderInfo()
- walletRecord = makeProvider(provider)
- })
-
- describe('Safes Selector[safesByOwnerSelector]', () => {
- it('should return empty list when no safes', () => {
- // GIVEN
- const reduxStore = {
- [PROVIDER_REDUCER_ID]: walletRecord,
- [SAFE_REDUCER_ID]: Map(),
- tokens: undefined,
- transactions: undefined,
- }
- const emptyList = List([])
-
- // WHEN
- const safes = safesByOwnerSelector(reduxStore, {})
-
- // THEN
- expect(safes).toEqual(emptyList)
- })
-
- it('should return a list of size 0 when 0 of 2 safes contains the user as owner', () => {
- // GIVEN
- let map: Map = Map()
- map = map.set('fooAddress', SafeFactory.oneOwnerSafe('foo'))
- map = map.set('barAddress', SafeFactory.twoOwnersSafe('foo', 'bar'))
-
- const reduxStore = {
- [PROVIDER_REDUCER_ID]: walletRecord,
- [SAFE_REDUCER_ID]: map,
- tokens: undefined,
- transactions: undefined,
- }
-
- // WHEN
- const safes = safesByOwnerSelector(reduxStore, {})
-
- // THEN
- expect(safes.count()).toEqual(0)
- })
-
- it('should return a list of size 1 when 1 of 2 safes contains the user as owner', () => {
- // GIVEN
- let map: Map = Map()
- map = map.set('fooAddress', SafeFactory.oneOwnerSafe(walletRecord.account))
- map = map.set('barAddress', SafeFactory.twoOwnersSafe('foo', 'bar'))
-
- const reduxStore = {
- [PROVIDER_REDUCER_ID]: walletRecord,
- [SAFE_REDUCER_ID]: map,
- tokens: undefined,
- transactions: undefined,
- }
-
- // WHEN
- const safes = safesByOwnerSelector(reduxStore, {})
-
- // THEN
- expect(safes.count()).toEqual(1)
- })
-
- it('should return a list of size 2 when 2 of 2 safes contains the user as owner', () => {
- // GIVEN
- let map: Map = Map()
- const userAccount = walletRecord.account
- map = map.set('fooAddress', SafeFactory.oneOwnerSafe(userAccount))
- map = map.set('barAddress', SafeFactory.twoOwnersSafe('foo', userAccount))
-
- const reduxStore = {
- [SAFE_REDUCER_ID]: map,
- [PROVIDER_REDUCER_ID]: walletRecord,
- tokens: undefined,
- transactions: undefined,
- }
-
- // WHEN
- const safes = safesByOwnerSelector(reduxStore, {})
-
- // THEN
- expect(safes.count()).toEqual(2)
- expect(safes.get(0)).not.toEqual(safes.get(1))
- })
-
- it('should return safes under owners case-insensitive', () => {
- // GIVEN
- let map: Map = Map()
- const userAccountUpper = walletRecord.account.toUpperCase()
- map = map.set('fooAddress', SafeFactory.oneOwnerSafe(userAccountUpper))
- map = map.set('barAddress', SafeFactory.twoOwnersSafe('foo', userAccountUpper))
-
- const reduxStore = {
- [SAFE_REDUCER_ID]: map,
- [PROVIDER_REDUCER_ID]: walletRecord,
- tokens: undefined,
- transactions: undefined,
- }
-
- // WHEN
- const safes = safesByOwnerSelector(reduxStore, {})
-
- // THEN
- expect(safes.count()).toEqual(2)
- expect(safes.get(0)).not.toEqual(safes.get(1))
- })
- })
-}
-
-export default safesListSelectorTests
diff --git a/src/test/builder/safe.dom.builder.js b/src/test/builder/safe.dom.builder.js
index 89c61b6f..80bf6bfe 100644
--- a/src/test/builder/safe.dom.builder.js
+++ b/src/test/builder/safe.dom.builder.js
@@ -1,27 +1,19 @@
// @flow
import { type Store } from 'redux'
-import TestUtils from 'react-dom/test-utils'
-import SafeView from '~/routes/safe/components/Safe'
import { aNewStore, type GlobalState } from '~/store'
import { sleep } from '~/utils/timer'
import { getWeb3 } from '~/logic/wallets/getWeb3'
import { sendEtherTo } from '~/test/utils/tokenMovements'
import { aMinedSafe } from '~/test/builder/safe.redux.builder'
import { renderSafeView } from '~/test/builder/safe.dom.utils'
-import { MOVE_FUNDS_BUTTON_TEXT } from '~/routes/safe/components/Safe/BalanceInfo'
export type DomSafe = {
address: string,
- safeButtons: Element[],
- safe: React.Component,
accounts: string[],
store: Store,
+ SafeDom: any,
}
-export const filterMoveButtonsFrom = (buttons: Element[]) => buttons.filter(
- (button: Element): boolean => button.getElementsByTagName('span')[0].textContent !== MOVE_FUNDS_BUTTON_TEXT,
-)
-
export const renderSafeInDom = async (owners: number = 1, threshold: number = 1): Promise => {
// create store
const store = aNewStore()
@@ -37,16 +29,9 @@ export const renderSafeInDom = async (owners: number = 1, threshold: number = 1)
// wait until funds are displayed and buttons are enabled
await sleep(3000)
- // $FlowFixMe
- const Safe = TestUtils.findRenderedComponentWithType(SafeDom, SafeView)
- // $FlowFixMe
- const buttons = TestUtils.scryRenderedDOMComponentsWithTag(Safe, 'button')
- const filteredButtons = filterMoveButtonsFrom(buttons)
-
return {
address,
- safeButtons: filteredButtons,
- safe: SafeDom,
+ SafeDom,
accounts,
store,
}
diff --git a/src/test/builder/tokens.dom.utils.js b/src/test/builder/tokens.dom.utils.js
index f3ff89ee..5602f029 100644
--- a/src/test/builder/tokens.dom.utils.js
+++ b/src/test/builder/tokens.dom.utils.js
@@ -18,11 +18,7 @@ export const enableFirstToken = async (store: Store, safeAddress: string) => {
TestUtils.Simulate.change(firstTokenInput, { target: { checked: 'true' } })
}
-export const testToken = (token: Token | typeof undefined, symbol: string, status: boolean, funds?: string) => {
+export const testToken = (token: Token | typeof undefined, symbol: string) => {
if (!token) throw new Error()
expect(token.get('symbol')).toBe(symbol)
- expect(token.get('status')).toBe(status)
- if (funds) {
- expect(token.get('funds')).toBe(funds)
- }
}
diff --git a/src/test/safe.dom.tokens.test.js b/src/test/safe.dom.tokens.test.js
deleted file mode 100644
index fe5e856c..00000000
--- a/src/test/safe.dom.tokens.test.js
+++ /dev/null
@@ -1,73 +0,0 @@
-// @flow
-
-import TestUtils from 'react-dom/test-utils'
-import * as fetchBalancesAction from '~/logic/tokens/store/actions/fetchTokens'
-import { aNewStore } from '~/store'
-import { aMinedSafe } from '~/test/builder/safe.redux.builder'
-import { addTknTo, getFirstTokenContract } from '~/test/utils/tokenMovements'
-import { EXPAND_BALANCE_INDEX, travelToSafe } from '~/test/builder/safe.dom.utils'
-import { getWeb3 } from '~/logic/wallets/getWeb3'
-import { sendMoveTokensForm, dispatchTknBalance } from '~/test/utils/transactions/moveTokens.helper'
-import { sleep } from '~/utils/timer'
-
-describe('DOM > Feature > SAFE ERC20 TOKENS', () => {
- let accounts
- beforeEach(async () => {
- accounts = await getWeb3().eth.getAccounts()
- })
-
- it('sends ERC20 tokens', async () => {
- // GIVEN
- const store = aNewStore()
- const safeAddress = await aMinedSafe(store)
-
- const numTokens = '100'
- const tokenAddress = await addTknTo(safeAddress, numTokens)
-
- await dispatchTknBalance(store, tokenAddress, safeAddress)
- // const StandardToken = await fetchBalancesAction.getStandardTokenContract()
- // const myToken = await StandardToken.at(tokenAddress)
- // console.log(await myToken.allowance(safeAddress, accounts[2]))
- // console.log(await myToken.balanceOf(safeAddress))
-
- // WHEN
- const SafeDom = await travelToSafe(store, safeAddress)
- await sleep(800)
- // $FlowFixMe
- const buttons = TestUtils.scryRenderedDOMComponentsWithTag(SafeDom, 'button')
- const expandBalance = buttons[EXPAND_BALANCE_INDEX]
- const receiver = accounts[2]
- await sendMoveTokensForm(SafeDom, expandBalance, 20, accounts[2])
-
- // THEN
- const safeFunds = await fetchBalancesAction.calculateBalanceOf(tokenAddress, safeAddress, 18)
- expect(Number(safeFunds)).toBe(80)
- const receiverFunds = await fetchBalancesAction.calculateBalanceOf(tokenAddress, receiver, 18)
- expect(Number(receiverFunds)).toBe(20)
-
- const token = await getFirstTokenContract(getWeb3(), accounts[0])
- const nativeSafeFunds = await token.balanceOf(safeAddress)
- expect(Number(nativeSafeFunds.valueOf())).toEqual(80 * 10 ** 18)
- })
-
- it('disables send token button when balance is 0', async () => {
- // GIVEN
- const token = await getFirstTokenContract(getWeb3(), accounts[0])
- await dispatchTknBalance(store, token.address, safeAddress)
-
- // WHEN
- const SafeDom = travelToSafe(store, safeAddress)
-
- // $FlowFixMe
- const buttons = TestUtils.scryRenderedDOMComponentsWithTag(SafeDom, 'button')
- const expandBalance = buttons[EXPAND_BALANCE_INDEX]
-
- TestUtils.Simulate.click(expandBalance)
- await sleep(800)
-
- // $FlowFixMe
- const balanceButtons = TestUtils.scryRenderedDOMComponentsWithTag(SafeDom, 'button')
- const tokenButton = balanceButtons[EXPAND_BALANCE_INDEX + 1] // expand button, and the next one is for sending
- expect(tokenButton.hasAttribute('disabled')).toBe(true)
- })
-})
diff --git a/src/test/safe.dom.transactions.test.js b/src/test/safe.dom.transactions.test.js
index f492ffad..ba93243c 100644
--- a/src/test/safe.dom.transactions.test.js
+++ b/src/test/safe.dom.transactions.test.js
@@ -1,147 +1,17 @@
// @flow
-import TestUtils from 'react-dom/test-utils'
-import { List } from 'immutable'
-import Transaction from '~/routes/safe/components/Transactions/Transaction'
-import {
- listTxsClickingOn,
- LIST_TXS_INDEX,
- ADD_OWNERS_INDEX,
- EXPAND_OWNERS_INDEX,
- EDIT_THRESHOLD_INDEX,
- refreshTransactions,
- EXPAND_BALANCE_INDEX,
-} from '~/test/builder/safe.dom.utils'
-import { renderSafeInDom, type DomSafe } from '~/test/builder/safe.dom.builder'
-import {
- sendMoveFundsForm,
- checkMinedMoveFundsTx,
- checkPendingMoveFundsTx,
-} from '~/test/utils/transactions/moveFunds.helper'
-import {
- sendAddOwnerForm,
- checkMinedAddOwnerTx,
- checkPendingAddOwnerTx,
-} from '~/test/utils/transactions/addOwner.helper'
-import {
- sendRemoveOwnerForm,
- checkMinedRemoveOwnerTx,
- checkPendingRemoveOwnerTx,
-} from '~/test/utils/transactions/removeOwner.helper'
-import {
- checkMinedThresholdTx,
- sendChangeThresholdForm,
- checkThresholdOf,
-} from '~/test/utils/transactions/threshold.helper'
-import { checkBalanceOf } from '~/test/utils/tokenMovements'
-import { sleep } from '~/utils/timer'
-import { processTransaction } from '~/logic/safe/safeFrontendOperations'
+
+// TBD
describe('DOM > Feature > SAFE MULTISIG Transactions', () => {
- let domSafe: DomSafe
it.only('mines correctly all multisig txs in a 1 owner & 1 threshold safe', async () => {
- // GIVEN one safe with 1 owner and 1 threshold
- const owners = 1
- const threshold = 1
- domSafe = await renderSafeInDom(owners, threshold)
- const {
- address, safe: SafeDom, safeButtons, accounts, store,
- } = domSafe
- // WHEN
- await sendMoveFundsForm(SafeDom, safeButtons[EXPAND_BALANCE_INDEX], '0.01', accounts[1])
- await sendAddOwnerForm(SafeDom, safeButtons[ADD_OWNERS_INDEX], 'Adol Metamask 2', accounts[1])
- await sleep(1200)
- await sendChangeThresholdForm(SafeDom, safeButtons[EDIT_THRESHOLD_INDEX], '2')
-
- // THEN
- await listTxsClickingOn(store, safeButtons[LIST_TXS_INDEX], address)
- const transactions = TestUtils.scryRenderedComponentsWithType(SafeDom, Transaction)
-
- checkMinedMoveFundsTx(transactions[0], 'Send 0.01 ETH to')
- checkMinedAddOwnerTx(transactions[1], 'Add Owner Adol Metamask 2')
- checkMinedThresholdTx(transactions[2], "Change Safe's threshold")
})
it.only('mines withdraw process correctly all multisig txs in a 2 owner & 2 threshold safe', async () => {
- // GIVEN reusing the state from previous test
- const {
- address, safe: SafeDom, safeButtons, accounts, store,
- } = domSafe
- // WHEN
- await sendMoveFundsForm(SafeDom, safeButtons[EXPAND_BALANCE_INDEX], '0.01', accounts[1])
- const increaseThreshold = true
- await sendAddOwnerForm(SafeDom, safeButtons[ADD_OWNERS_INDEX], 'Adol Metamask 3', accounts[2], increaseThreshold)
-
- // THEN
- await listTxsClickingOn(store, safeButtons[LIST_TXS_INDEX], address)
- const transactions = TestUtils.scryRenderedComponentsWithType(SafeDom, Transaction)
-
- const statusses = ['Adol 1 Eth Account [Confirmed]']
- await checkPendingMoveFundsTx(transactions[3], 2, 'Send 0.01 ETH to', statusses)
- await checkPendingAddOwnerTx(transactions[4], 2, 'Add Owner Adol Metamask 3', statusses)
- await checkBalanceOf(address, '0.09')
})
it.only('approves and executes pending transactions', async () => {
- // GIVEN reusing the state from previous test
- const {
- address, safe: SafeDom, safeButtons, accounts, store,
- } = domSafe
- let transactions = TestUtils.scryRenderedComponentsWithType(SafeDom, Transaction)
- expect(transactions.length).toBe(5)
- await checkThresholdOf(address, 2)
-
- // WHEN... processing pending TXs
- await processTransaction(address, transactions[3].props.transaction, 1, accounts[1], 2, List([accounts[0]]))
- await processTransaction(address, transactions[4].props.transaction, 1, accounts[1], 2, List([accounts[0]]))
- await refreshTransactions(store, address)
-
- // THEN
- checkMinedMoveFundsTx(transactions[3], 'Send 0.01 ETH to')
- await checkBalanceOf(address, '0.08')
- checkMinedAddOwnerTx(transactions[4], 'Add Owner Adol Metamask 3')
- await checkThresholdOf(address, 3)
-
- // WHEN... reducing threshold
- await sendRemoveOwnerForm(SafeDom, safeButtons[EXPAND_OWNERS_INDEX])
-
- // THEN
- await listTxsClickingOn(store, safeButtons[LIST_TXS_INDEX], address)
- transactions = TestUtils.scryRenderedComponentsWithType(SafeDom, Transaction)
- expect(transactions.length).toBe(6)
- let statusses = ['Adol 1 Eth Account [Confirmed]']
- await checkPendingRemoveOwnerTx(transactions[5], 3, 'Remove Owner Adol Metamask 3', statusses)
-
- await processTransaction(address, transactions[5].props.transaction, 1, accounts[2], 3, List([accounts[0]]))
- await refreshTransactions(store, address)
-
- transactions = TestUtils.scryRenderedComponentsWithType(SafeDom, Transaction)
- statusses = ['Adol Metamask 3 [Confirmed]', 'Adol 1 Eth Account [Confirmed]']
- await checkPendingRemoveOwnerTx(transactions[5], 3, 'Remove Owner Adol Metamask 3', statusses)
- await checkThresholdOf(address, 3)
- await processTransaction(
- address,
- transactions[5].props.transaction,
- 2,
- accounts[1],
- 3,
- List([accounts[0], accounts[2]]),
- )
-
- await refreshTransactions(store, address)
- await checkThresholdOf(address, 2)
- transactions = TestUtils.scryRenderedComponentsWithType(SafeDom, Transaction)
- await checkMinedRemoveOwnerTx(transactions[5], 'Remove Owner')
-
- // WHEN... changing threshold
- await sendChangeThresholdForm(SafeDom, safeButtons[EDIT_THRESHOLD_INDEX], '1')
- await listTxsClickingOn(store, safeButtons[LIST_TXS_INDEX], address)
-
- // THEN
- transactions = TestUtils.scryRenderedComponentsWithType(SafeDom, Transaction)
- await processTransaction(address, transactions[6].props.transaction, 1, accounts[1], 2, List([accounts[0]]))
- await checkThresholdOf(address, 1)
})
})
diff --git a/src/test/tokens.dom.adding.test.js b/src/test/tokens.dom.adding.test.js
index 254da554..5322d820 100644
--- a/src/test/tokens.dom.adding.test.js
+++ b/src/test/tokens.dom.adding.test.js
@@ -12,7 +12,6 @@ import { tokenListSelector } from '~/logic/tokens/store/selectors'
import { testToken } from '~/test/builder/tokens.dom.utils'
import * as fetchTokensModule from '~/logic/tokens/store/actions/fetchTokens'
import * as enhancedFetchModule from '~/utils/fetch'
-import { clickOnAddToken, fillAddress, fillHumanReadableInfo } from '~/test/utils/tokens/addToken.helper'
describe('DOM > Feature > Add new ERC 20 Tokens', () => {
// let web3
diff --git a/src/test/tokens.dom.removing.test.js b/src/test/tokens.dom.removing.test.js
deleted file mode 100644
index 0eb67ed3..00000000
--- a/src/test/tokens.dom.removing.test.js
+++ /dev/null
@@ -1,71 +0,0 @@
-// @flow
-import * as TestUtils from 'react-dom/test-utils'
-import { getWeb3 } from '~/logic/wallets/getWeb3'
-import { getFirstTokenContract, getSecondTokenContract } from '~/test/utils/tokenMovements'
-import { aNewStore } from '~/store'
-import { aMinedSafe } from '~/test/builder/safe.redux.builder'
-import { travelToTokens } from '~/test/builder/safe.dom.utils'
-import * as fetchTokensModule from '~/logic/tokens/store/actions/fetchTokens'
-import * as enhancedFetchModule from '~/utils/fetch'
-import addToken from '~/logic/tokens/store/actions/addToken'
-import { sleep } from '~/utils/timer'
-import { testToken } from '~/test/builder/tokens.dom.utils'
-
-describe('DOM > Feature > Add new ERC 20 Tokens', () => {
- // let web3
- // let accounts
- // let firstErc20Token
- // let secondErc20Token
- // beforeAll(async () => {
- // web3 = getWeb3()
- // accounts = await web3.eth.getAccounts()
- // firstErc20Token = await getFirstTokenContract(web3, accounts[0])
- // secondErc20Token = await getSecondTokenContract(web3, accounts[0])
- // // $FlowFixMe
- // enhancedFetchModule.enhancedFetch = jest.fn()
- // enhancedFetchModule.enhancedFetch.mockImplementation(() => Promise.resolve({
- // results: [
- // {
- // address: firstErc20Token.address,
- // name: 'First Token Example',
- // symbol: 'FTE',
- // decimals: 18,
- // logoUri: 'https://upload.wikimedia.org/wikipedia/commons/c/c0/Earth_simple_icon.png',
- // },
- // ],
- // }))
- // })
- // it('remove custom ERC 20 tokens', async () => {
- // // GIVEN
- // const store = aNewStore()
- // const safeAddress = await aMinedSafe(store)
- // await store.dispatch(fetchTokensModule.fetchTokens(safeAddress))
- // const values = {
- // [TOKEN_ADRESS_PARAM]: secondErc20Token.address,
- // [TOKEN_NAME_PARAM]: 'Custom ERC20 Token',
- // [TOKEN_SYMBOL_PARAM]: 'CTS',
- // [TOKEN_DECIMALS_PARAM]: '10',
- // [TOKEN_LOGO_URL_PARAM]: 'https://example.com',
- // }
- // const customAddTokensFn: any = (...args) => store.dispatch(addToken(...args))
- // await addTokenFnc(values, customAddTokensFn, safeAddress)
- // const TokensDom = travelToTokens(store, safeAddress)
- // await sleep(400)
- // // WHEN
- // const buttons = TestUtils.scryRenderedDOMComponentsWithTag(TokensDom, 'button')
- // expect(buttons.length).toBe(2)
- // const removeUserButton = buttons[0]
- // expect(removeUserButton.getAttribute('aria-label')).toBe('Delete')
- // TestUtils.Simulate.click(removeUserButton)
- // await sleep(400)
- // const form = TestUtils.findRenderedDOMComponentWithTag(TokensDom, 'form')
- // // submit it
- // TestUtils.Simulate.submit(form)
- // TestUtils.Simulate.submit(form)
- // await sleep(400)
- // const tokens = TestUtils.scryRenderedComponentsWithType(TokensDom, TokenComponent)
- // expect(tokens.length).toBe(2)
- // testToken(tokens[0].props.token, 'FTE', false)
- // testToken(tokens[1].props.token, 'ETH', true)
- // })
-})
diff --git a/src/test/utils/Wrapper.jsx b/src/test/utils/Wrapper.jsx
deleted file mode 100644
index 7f31f0cb..00000000
--- a/src/test/utils/Wrapper.jsx
+++ /dev/null
@@ -1,10 +0,0 @@
-// @flow
-import * as React from 'react'
-
-type WrapperProps = {
- children: React.Node,
-}
-
-const Wrapper = ({ children }: WrapperProps) => {children}
-
-export default Wrapper
diff --git a/src/test/utils/buildReactRouterProps.js b/src/test/utils/buildReactRouterProps.js
index 6123f8c7..379e26d8 100644
--- a/src/test/utils/buildReactRouterProps.js
+++ b/src/test/utils/buildReactRouterProps.js
@@ -1,7 +1,7 @@
// @flow
import { type Match } from 'react-router-dom'
-export const buildMathPropsFrom = (address: string): Match => ({
+export const buildMatchPropsFrom = (address: string): Match => ({
params: {
address,
},
diff --git a/src/test/utils/logTransactions.js b/src/test/utils/logTransactions.js
index a3e7f3be..e76f197e 100644
--- a/src/test/utils/logTransactions.js
+++ b/src/test/utils/logTransactions.js
@@ -1,4 +1,5 @@
// @flow
+import React from 'react'
import { getGnosisSafeInstanceAt } from '~/logic/contracts/safeContracts'
import GnoStepper from '~/components/Stepper'
import Stepper from '@material-ui/core/Stepper'
diff --git a/src/test/utils/safeHelper.js b/src/test/utils/safeHelper.js
index 077e8a7d..6449ff9d 100644
--- a/src/test/utils/safeHelper.js
+++ b/src/test/utils/safeHelper.js
@@ -1,12 +1,12 @@
// @flow
-import { buildMathPropsFrom } from '~/test/utils/buildReactRouterProps'
+import { buildMatchPropsFrom } from '~/test/utils/buildReactRouterProps'
import { safeSelector } from '~/routes/safe/store/selectors/index'
import { type Match } from 'react-router-dom'
import { type GlobalState } from '~/store'
import { type Safe } from '~/routes/safe/store/models/safe'
export const getSafeFrom = (state: GlobalState, safeAddress: string): Safe => {
- const match: Match = buildMathPropsFrom(safeAddress)
+ const match: Match = buildMatchPropsFrom(safeAddress)
const safe = safeSelector(state, { match })
if (!safe) throw new Error()
diff --git a/src/test/utils/tokens/addToken.helper.js b/src/test/utils/tokens/addToken.helper.js
deleted file mode 100644
index f723b4e4..00000000
--- a/src/test/utils/tokens/addToken.helper.js
+++ /dev/null
@@ -1,46 +0,0 @@
-// @flow
-import { sleep } from '~/utils/timer'
-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) => {
- 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) => {
- // fill the form
- const AddTokenComponent = TestUtils.findRenderedComponentWithType(TokensDom, AddToken)
- if (!AddTokenComponent) throw new Error()
-
- const inputs = TestUtils.scryRenderedDOMComponentsWithTag(AddTokenComponent, 'input')
- expect(inputs.length).toBe(1)
- const tokenAddressInput = inputs[0]
- TestUtils.Simulate.change(tokenAddressInput, { target: { value: `${secondErc20Token.address}` } })
- // $FlowFixMe
- const form = TestUtils.findRenderedDOMComponentWithTag(AddTokenComponent, 'form')
- // submit it
- TestUtils.Simulate.submit(form)
-
- return whenOnNext(TokensDom, AddToken, 1)
-}
-
-export const fillHumanReadableInfo = async (TokensDom: React.Component) => {
- // fill the form
- const AddTokenComponent = TestUtils.findRenderedComponentWithType(TokensDom, AddToken)
- if (!AddTokenComponent) throw new Error()
-
- const inputs = TestUtils.scryRenderedDOMComponentsWithTag(AddTokenComponent, 'input')
- expect(inputs.length).toBe(4)
- TestUtils.Simulate.change(inputs[3], { target: { value: 'https://my.token.image/foo' } })
- const form = TestUtils.findRenderedDOMComponentWithTag(AddTokenComponent, 'form')
-
- // submit it
- TestUtils.Simulate.submit(form)
- TestUtils.Simulate.submit(form)
-
- return whenExecuted(TokensDom, AddToken)
-}
diff --git a/src/test/utils/transactions/removeOwner.helper.js b/src/test/utils/transactions/removeOwner.helper.js
index 41944828..fd492ae9 100644
--- a/src/test/utils/transactions/removeOwner.helper.js
+++ b/src/test/utils/transactions/removeOwner.helper.js
@@ -1,4 +1,5 @@
// @flow
+import * as React from 'react'
import TestUtils from 'react-dom/test-utils'
import { sleep } from '~/utils/timer'
import { checkMinedTx, EXPAND_OWNERS_INDEX, checkPendingTx } from '~/test/builder/safe.dom.utils'