mirror of
https://github.com/status-im/safe-react.git
synced 2025-02-20 05:28:08 +00:00
WA-238 Added test for enabling add tx button when the safe has funds
This commit is contained in:
parent
bc9b2be6a1
commit
0fb1758fc5
@ -16,6 +16,7 @@ import { getBalanceInEtherOf } from '~/wallets/getWeb3'
|
|||||||
import { sleep } from '~/utils/timer'
|
import { sleep } from '~/utils/timer'
|
||||||
import { getDailyLimitFrom } from '~/routes/safe/component/Withdrawn/withdrawn'
|
import { getDailyLimitFrom } from '~/routes/safe/component/Withdrawn/withdrawn'
|
||||||
import { type DailyLimitProps } from '~/routes/safe/store/model/dailyLimit'
|
import { type DailyLimitProps } from '~/routes/safe/store/model/dailyLimit'
|
||||||
|
import { ADD_MULTISIG_BUTTON_TEXT } from '~/routes/safe/component/Safe/MultisigTx'
|
||||||
|
|
||||||
describe('React DOM TESTS > Withdrawn funds from safe', () => {
|
describe('React DOM TESTS > Withdrawn funds from safe', () => {
|
||||||
let SafeDom
|
let SafeDom
|
||||||
@ -26,8 +27,6 @@ describe('React DOM TESTS > Withdrawn funds from safe', () => {
|
|||||||
store = aNewStore()
|
store = aNewStore()
|
||||||
// deploy safe updating store
|
// deploy safe updating store
|
||||||
address = await aDeployedSafe(store)
|
address = await aDeployedSafe(store)
|
||||||
// add funds to safe
|
|
||||||
await addEtherTo(address, '0.1')
|
|
||||||
// navigate to SAFE route
|
// navigate to SAFE route
|
||||||
history.push(`${SAFELIST_ADDRESS}/${address}`)
|
history.push(`${SAFELIST_ADDRESS}/${address}`)
|
||||||
SafeDom = TestUtils.renderIntoDocument((
|
SafeDom = TestUtils.renderIntoDocument((
|
||||||
@ -40,6 +39,8 @@ describe('React DOM TESTS > Withdrawn funds from safe', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should withdrawn funds under dailyLimit without needing confirmations', async () => {
|
it('should withdrawn funds under dailyLimit without needing confirmations', async () => {
|
||||||
|
// add funds to safe
|
||||||
|
await addEtherTo(address, '0.1')
|
||||||
const Safe = TestUtils.findRenderedComponentWithType(SafeDom, SafeView)
|
const Safe = TestUtils.findRenderedComponentWithType(SafeDom, SafeView)
|
||||||
|
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
@ -74,6 +75,9 @@ describe('React DOM TESTS > Withdrawn funds from safe', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('spentToday dailyLimitModule property is updated correctly', async () => {
|
it('spentToday dailyLimitModule property is updated correctly', async () => {
|
||||||
|
// add funds to safe
|
||||||
|
await addEtherTo(address, '0.1')
|
||||||
|
|
||||||
// GIVEN in beforeEach
|
// GIVEN in beforeEach
|
||||||
// WHEN
|
// WHEN
|
||||||
await executeWithdrawnOn(address, 0.01)
|
await executeWithdrawnOn(address, 0.01)
|
||||||
@ -86,4 +90,18 @@ describe('React DOM TESTS > Withdrawn funds from safe', () => {
|
|||||||
expect(dailyLimit.value).toBe(0.5)
|
expect(dailyLimit.value).toBe(0.5)
|
||||||
expect(dailyLimit.spentToday).toBe(0.02)
|
expect(dailyLimit.spentToday).toBe(0.02)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('add multisig txs button disabled when balance is 0', async () => {
|
||||||
|
const Safe = TestUtils.findRenderedComponentWithType(SafeDom, SafeView)
|
||||||
|
// $FlowFixMe
|
||||||
|
const buttons = TestUtils.scryRenderedComponentsWithType(Safe, Button)
|
||||||
|
const addTxButton = buttons[1]
|
||||||
|
expect(addTxButton.props.children).toEqual(ADD_MULTISIG_BUTTON_TEXT)
|
||||||
|
expect(addTxButton.props.disabled).toBe(true)
|
||||||
|
|
||||||
|
await addEtherTo(address, '0.1')
|
||||||
|
await sleep(1800)
|
||||||
|
|
||||||
|
expect(addTxButton.props.disabled).toBe(false)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user