mirror of
https://github.com/status-im/safe-react.git
synced 2025-02-18 20:46:29 +00:00
WA-238 Fixing tests including Daily Limit
This commit is contained in:
parent
7dbc14f31e
commit
7a05972d7f
@ -1,7 +1,14 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import TestUtils from 'react-dom/test-utils'
|
import TestUtils from 'react-dom/test-utils'
|
||||||
import { store } from '~/store'
|
import { store } from '~/store'
|
||||||
import { FIELD_NAME, FIELD_OWNERS, FIELD_CONFIRMATIONS, getOwnerNameBy, getOwnerAddressBy } from '~/routes/open/components/fields'
|
import {
|
||||||
|
FIELD_NAME,
|
||||||
|
FIELD_OWNERS,
|
||||||
|
FIELD_CONFIRMATIONS,
|
||||||
|
FIELD_DAILY_LIMIT,
|
||||||
|
getOwnerNameBy,
|
||||||
|
getOwnerAddressBy,
|
||||||
|
} from '~/routes/open/components/fields'
|
||||||
import { DEPLOYED_COMPONENT_ID } from '~/routes/open/components/FormConfirmation'
|
import { DEPLOYED_COMPONENT_ID } from '~/routes/open/components/FormConfirmation'
|
||||||
import { sleep } from '~/utils/timer'
|
import { sleep } from '~/utils/timer'
|
||||||
import { getProviderInfo } from '~/wallets/getWeb3'
|
import { getProviderInfo } from '~/wallets/getWeb3'
|
||||||
@ -26,6 +33,9 @@ describe('React DOM TESTS > Create Safe form', () => {
|
|||||||
const fieldConfirmations = inputs[2]
|
const fieldConfirmations = inputs[2]
|
||||||
expect(fieldConfirmations.name).toEqual(FIELD_CONFIRMATIONS)
|
expect(fieldConfirmations.name).toEqual(FIELD_CONFIRMATIONS)
|
||||||
|
|
||||||
|
const dailyLimitConfirmations = inputs[3]
|
||||||
|
expect(dailyLimitConfirmations.name).toEqual(FIELD_DAILY_LIMIT)
|
||||||
|
|
||||||
TestUtils.Simulate.change(fieldOwners, { target: { value: '1' } })
|
TestUtils.Simulate.change(fieldOwners, { target: { value: '1' } })
|
||||||
const inputsExpanded = TestUtils.scryRenderedDOMComponentsWithTag(open, 'input')
|
const inputsExpanded = TestUtils.scryRenderedDOMComponentsWithTag(open, 'input')
|
||||||
|
|
||||||
@ -39,6 +49,7 @@ describe('React DOM TESTS > Create Safe form', () => {
|
|||||||
TestUtils.Simulate.change(fieldName, { target: { value: 'Adolfo Safe' } })
|
TestUtils.Simulate.change(fieldName, { target: { value: 'Adolfo Safe' } })
|
||||||
TestUtils.Simulate.change(fieldConfirmations, { target: { value: '1' } })
|
TestUtils.Simulate.change(fieldConfirmations, { target: { value: '1' } })
|
||||||
TestUtils.Simulate.change(ownerName, { target: { value: 'Adolfo Eth Account' } })
|
TestUtils.Simulate.change(ownerName, { target: { value: 'Adolfo Eth Account' } })
|
||||||
|
TestUtils.Simulate.change(dailyLimitConfirmations, { target: { value: '10' } })
|
||||||
|
|
||||||
const form = TestUtils.findRenderedDOMComponentWithTag(open, 'form')
|
const form = TestUtils.findRenderedDOMComponentWithTag(open, 'form')
|
||||||
// One submit per step when creating a safe
|
// One submit per step when creating a safe
|
||||||
|
@ -49,7 +49,7 @@ describe('React DOM TESTS > Create Safe form', () => {
|
|||||||
|
|
||||||
// THEN
|
// THEN
|
||||||
const muiFields = TestUtils.scryRenderedComponentsWithType(open, TextField)
|
const muiFields = TestUtils.scryRenderedComponentsWithType(open, TextField)
|
||||||
expect(5).toEqual(muiFields.length)
|
expect(6).toEqual(muiFields.length)
|
||||||
const confirmationsField = muiFields[4]
|
const confirmationsField = muiFields[4]
|
||||||
|
|
||||||
expect(confirmationsField.props.meta.valid).toBe(false)
|
expect(confirmationsField.props.meta.valid).toBe(false)
|
||||||
@ -64,7 +64,7 @@ describe('React DOM TESTS > Create Safe form', () => {
|
|||||||
|
|
||||||
// THEN
|
// THEN
|
||||||
const muiFields = TestUtils.scryRenderedComponentsWithType(open, TextField)
|
const muiFields = TestUtils.scryRenderedComponentsWithType(open, TextField)
|
||||||
expect(7).toEqual(muiFields.length)
|
expect(8).toEqual(muiFields.length)
|
||||||
const confirmationsField = muiFields[6]
|
const confirmationsField = muiFields[6]
|
||||||
|
|
||||||
expect(confirmationsField.props.meta.valid).toBe(false)
|
expect(confirmationsField.props.meta.valid).toBe(false)
|
||||||
|
@ -33,6 +33,7 @@ const deploySafe = async (safe: React$Component<{}>) => {
|
|||||||
const fieldName = inputs[0]
|
const fieldName = inputs[0]
|
||||||
const fieldOwners = inputs[1]
|
const fieldOwners = inputs[1]
|
||||||
const fieldConfirmations = inputs[2]
|
const fieldConfirmations = inputs[2]
|
||||||
|
const fieldDailyLimit = inputs[3]
|
||||||
|
|
||||||
TestUtils.Simulate.change(fieldOwners, { target: { value: '1' } })
|
TestUtils.Simulate.change(fieldOwners, { target: { value: '1' } })
|
||||||
const inputsExpanded = TestUtils.scryRenderedDOMComponentsWithTag(safe, 'input')
|
const inputsExpanded = TestUtils.scryRenderedDOMComponentsWithTag(safe, 'input')
|
||||||
@ -41,6 +42,7 @@ const deploySafe = async (safe: React$Component<{}>) => {
|
|||||||
TestUtils.Simulate.change(fieldName, { target: { value: 'Adolfo Safe' } })
|
TestUtils.Simulate.change(fieldName, { target: { value: 'Adolfo Safe' } })
|
||||||
TestUtils.Simulate.change(fieldConfirmations, { target: { value: '1' } })
|
TestUtils.Simulate.change(fieldConfirmations, { target: { value: '1' } })
|
||||||
TestUtils.Simulate.change(ownerName, { target: { value: 'Adolfo Eth Account' } })
|
TestUtils.Simulate.change(ownerName, { target: { value: 'Adolfo Eth Account' } })
|
||||||
|
TestUtils.Simulate.change(fieldDailyLimit, { target: { value: '10' } })
|
||||||
|
|
||||||
const form = TestUtils.findRenderedDOMComponentWithTag(safe, 'form')
|
const form = TestUtils.findRenderedDOMComponentWithTag(safe, 'form')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user