From 7a05972d7fe14776dd1e22f1acab68a856755f6a Mon Sep 17 00:00:00 2001 From: apanizo Date: Fri, 27 Apr 2018 13:29:44 +0200 Subject: [PATCH] WA-238 Fixing tests including Daily Limit --- src/routes/open/components/Layout.test.js | 13 ++++++++++++- .../components/SafeForm/Confirmations/index.test.js | 4 ++-- .../safe/store/test/builder/deployedSafe.builder.js | 2 ++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/routes/open/components/Layout.test.js b/src/routes/open/components/Layout.test.js index 4193d974..db2eaf1f 100644 --- a/src/routes/open/components/Layout.test.js +++ b/src/routes/open/components/Layout.test.js @@ -1,7 +1,14 @@ // @flow import TestUtils from 'react-dom/test-utils' 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 { sleep } from '~/utils/timer' import { getProviderInfo } from '~/wallets/getWeb3' @@ -26,6 +33,9 @@ describe('React DOM TESTS > Create Safe form', () => { const fieldConfirmations = inputs[2] expect(fieldConfirmations.name).toEqual(FIELD_CONFIRMATIONS) + const dailyLimitConfirmations = inputs[3] + expect(dailyLimitConfirmations.name).toEqual(FIELD_DAILY_LIMIT) + TestUtils.Simulate.change(fieldOwners, { target: { value: '1' } }) 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(fieldConfirmations, { target: { value: '1' } }) TestUtils.Simulate.change(ownerName, { target: { value: 'Adolfo Eth Account' } }) + TestUtils.Simulate.change(dailyLimitConfirmations, { target: { value: '10' } }) const form = TestUtils.findRenderedDOMComponentWithTag(open, 'form') // One submit per step when creating a safe diff --git a/src/routes/open/components/SafeForm/Confirmations/index.test.js b/src/routes/open/components/SafeForm/Confirmations/index.test.js index a86ae028..2c95c3c5 100644 --- a/src/routes/open/components/SafeForm/Confirmations/index.test.js +++ b/src/routes/open/components/SafeForm/Confirmations/index.test.js @@ -49,7 +49,7 @@ describe('React DOM TESTS > Create Safe form', () => { // THEN const muiFields = TestUtils.scryRenderedComponentsWithType(open, TextField) - expect(5).toEqual(muiFields.length) + expect(6).toEqual(muiFields.length) const confirmationsField = muiFields[4] expect(confirmationsField.props.meta.valid).toBe(false) @@ -64,7 +64,7 @@ describe('React DOM TESTS > Create Safe form', () => { // THEN const muiFields = TestUtils.scryRenderedComponentsWithType(open, TextField) - expect(7).toEqual(muiFields.length) + expect(8).toEqual(muiFields.length) const confirmationsField = muiFields[6] expect(confirmationsField.props.meta.valid).toBe(false) diff --git a/src/routes/safe/store/test/builder/deployedSafe.builder.js b/src/routes/safe/store/test/builder/deployedSafe.builder.js index 34bb71b0..6c9b9dca 100644 --- a/src/routes/safe/store/test/builder/deployedSafe.builder.js +++ b/src/routes/safe/store/test/builder/deployedSafe.builder.js @@ -33,6 +33,7 @@ const deploySafe = async (safe: React$Component<{}>) => { const fieldName = inputs[0] const fieldOwners = inputs[1] const fieldConfirmations = inputs[2] + const fieldDailyLimit = inputs[3] TestUtils.Simulate.change(fieldOwners, { target: { value: '1' } }) 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(fieldConfirmations, { target: { value: '1' } }) TestUtils.Simulate.change(ownerName, { target: { value: 'Adolfo Eth Account' } }) + TestUtils.Simulate.change(fieldDailyLimit, { target: { value: '10' } }) const form = TestUtils.findRenderedDOMComponentWithTag(safe, 'form')