Skip to content

Commit ad0b9b0

Browse files
committed
better testing
1 parent a14606e commit ad0b9b0

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const ACCOUNT_SELECTOR_LIST_TESTID = 'account-selector-list';

app/components/UI/AccountSelectorList/AccountSelectorList.test.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { AccountSelectorListProps } from './AccountSelectorList.types';
2020
import Engine from '../../../core/Engine';
2121
import { CellComponentSelectorsIDs } from '../../../../e2e/selectors/wallet/CellComponent.selectors';
2222
import { KeyringTypes } from '@metamask/keyring-controller';
23+
import { ACCOUNT_SELECTOR_LIST_TESTID } from './AccountSelectorList.constants';
2324

2425
const BUSINESS_ACCOUNT = '0xC4955C0d639D99699Bfd7Ec54d9FaFEe40e4D272';
2526
const PERSONAL_ACCOUNT = '0xd018538C87232FF95acbCe4870629b75640a78E7';
@@ -652,7 +653,7 @@ describe('AccountSelectorList', () => {
652653
);
653654

654655
// Simply check if the component renders
655-
expect(getByTestId('flat-list')).toBeDefined();
656+
expect(getByTestId(ACCOUNT_SELECTOR_LIST_TESTID)).toBeDefined();
656657
});
657658

658659
it('renders in select-without-menu mode', async () => {
@@ -930,7 +931,7 @@ describe('AccountSelectorList', () => {
930931
);
931932

932933
// Get the FlatList and trigger content size change
933-
const flatList = getByTestId('flat-list');
934+
const flatList = getByTestId(ACCOUNT_SELECTOR_LIST_TESTID);
934935
flatList.props.onContentSizeChange();
935936

936937
// Verify that scrollToOffset was not called

app/components/UI/AccountSelectorList/AccountSelectorList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import styleSheet from './AccountSelectorList.styles';
3636
import { AccountListBottomSheetSelectorsIDs } from '../../../../e2e/selectors/wallet/AccountListBottomSheet.selectors';
3737
import { WalletViewSelectorsIDs } from '../../../../e2e/selectors/wallet/WalletView.selectors';
3838
import { RootState } from '../../../reducers';
39+
import { ACCOUNT_SELECTOR_LIST_TESTID } from './AccountSelectorList.constants';
3940

4041
const AccountSelectorList = ({
4142
onSelectAccount,
@@ -318,7 +319,7 @@ const AccountSelectorList = ({
318319
renderItem={renderAccountItem}
319320
// Increasing number of items at initial render fixes scroll issue.
320321
initialNumToRender={999}
321-
testID="flat-list"
322+
testID={ACCOUNT_SELECTOR_LIST_TESTID}
322323
{...props}
323324
/>
324325
);

app/components/UI/AccountSelectorList/__snapshots__/AccountSelectorList.test.tsx.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ exports[`AccountSelectorList renders all accounts with balances 1`] = `
5151
renderScrollComponent={[Function]}
5252
scrollEventThrottle={50}
5353
stickyHeaderIndices={[]}
54-
testID="flat-list"
54+
testID="account-selector-list"
5555
viewabilityConfigCallbackPairs={[]}
5656
>
5757
<View>
@@ -844,7 +844,7 @@ exports[`AccountSelectorList renders all accounts with right accessory 1`] = `
844844
renderScrollComponent={[Function]}
845845
scrollEventThrottle={50}
846846
stickyHeaderIndices={[]}
847-
testID="flat-list"
847+
testID="account-selector-list"
848848
viewabilityConfigCallbackPairs={[]}
849849
>
850850
<View>
@@ -1521,7 +1521,7 @@ exports[`AccountSelectorList renders correctly 1`] = `
15211521
renderScrollComponent={[Function]}
15221522
scrollEventThrottle={50}
15231523
stickyHeaderIndices={[]}
1524-
testID="flat-list"
1524+
testID="account-selector-list"
15251525
viewabilityConfigCallbackPairs={[]}
15261526
>
15271527
<View>

app/components/Views/AccountPermissions/__snapshots__/AccountPermissions.test.tsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ exports[`AccountPermissions renders correctly 1`] = `
211211
renderScrollComponent={[Function]}
212212
scrollEventThrottle={50}
213213
stickyHeaderIndices={[]}
214+
testID="account-selector-list"
214215
viewabilityConfigCallbackPairs={[]}
215216
>
216217
<View />

0 commit comments

Comments
 (0)