Fix tests (finally)

This commit is contained in:
Mikhail Mikheev 2019-09-20 18:05:05 +04:00
parent e3b770b2bc
commit 60e2bb0fcf
4 changed files with 10 additions and 10 deletions

View File

@ -11,6 +11,7 @@ require('dotenv').config({ silent: true })
const jest = require('jest')
const argv = process.argv.slice(2)
argv.push('--runInBand')
// Watch unless on CI or in coverage mode
if (!process.env.CI && argv.indexOf('--coverage') < 0) {

View File

@ -1,5 +1,6 @@
// @flow
import { makeOwner } from '~/routes/safe/store/models/owner'
import { List } from 'immutable'
import { makeOwner, type Owner } from '~/routes/safe/store/models/owner'
export const getAccountsFrom = (values: Object): string[] => {
const accounts = Object.keys(values)
@ -17,10 +18,10 @@ export const getNamesFrom = (values: Object): string[] => {
return accounts.map((account) => values[account]).slice(0, values.owners)
}
export const getOwnersFrom = (names: string[], addresses: string[]): Array<string, string> => {
export const getOwnersFrom = (names: string[], addresses: string[]): List<Owner> => {
const owners = names.map((name: string, index: number) => makeOwner({ name, address: addresses[index] }))
return owners
return List(owners)
}
export const getThresholdFrom = (values: Object): number => Number(values.confirmations)

View File

@ -59,7 +59,7 @@ export const grantedSelector: Selector<GlobalState, RouterProps, boolean> = crea
return false
}
const owners: List<Owner> = safe.get('owners')
const { owners }: List<Owner> = safe
if (!owners) {
return false
}

View File

@ -1,5 +1,5 @@
// @flow
import { fireEvent } from '@testing-library/react'
import { fireEvent, waitForElement } from '@testing-library/react'
import { aNewStore } from '~/store'
import { aMinedSafe } from '~/test/builder/safe.redux.builder'
import { renderSafeView } from '~/test/builder/safe.dom.utils'
@ -55,17 +55,15 @@ describe('DOM > Feature > Settings - Manage owners', () => {
await sleep(1300)
// Travel to settings
const settingsBtn = SafeDom.getByTestId(SETTINGS_TAB_BTN_TEST_ID)
const settingsBtn = await waitForElement(() => SafeDom.getByTestId(SETTINGS_TAB_BTN_TEST_ID))
fireEvent.click(settingsBtn)
await sleep(200)
// click on owners settings
const ownersSettingsBtn = SafeDom.getByTestId(OWNERS_SETTINGS_TAB_TEST_ID)
const ownersSettingsBtn = await waitForElement(() => SafeDom.getByTestId(OWNERS_SETTINGS_TAB_TEST_ID))
fireEvent.click(ownersSettingsBtn)
await sleep(200)
// open rename owner modal
const renameOwnerBtn = SafeDom.getByTestId(RENAME_OWNER_BTN_TEST_ID)
const renameOwnerBtn = await waitForElement(() => SafeDom.getByTestId(RENAME_OWNER_BTN_TEST_ID))
fireEvent.click(renameOwnerBtn)
// rename owner