1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00
metamask-extension/ui/components/multichain/account-picker/account-picker.test.js
David Walsh 79d9c18cb1
UX: Multichain: Add address to account picker, change connection to copy button (#20520)
* UX: Multichain: Add address to account picker, change connection to copy button

* Fix for very long account names
2023-08-23 11:36:03 -05:00

54 lines
1.5 KiB
JavaScript

/* eslint-disable jest/require-top-level-describe */
import React from 'react';
import 'jest-canvas-mock';
import { renderWithProvider } from '../../../../test/jest';
import configureStore from '../../../store/store';
import mockState from '../../../../test/data/mock-state.json';
import { AccountPicker } from '.';
const DEFAULT_PROPS = {
name: 'Account 1',
address: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc',
onClick: () => undefined,
disabled: false,
};
const render = (props = {}, state = {}) => {
const store = configureStore({
metamask: {
...mockState.metamask,
providerConfig: {
chainId: '0x99',
},
...state,
},
});
return renderWithProvider(
<AccountPicker {...DEFAULT_PROPS} {...props} />,
store,
);
};
describe('AccountPicker', () => {
it('renders properly', () => {
const { container } = render({}, { useBlockie: true });
expect(container).toMatchSnapshot();
});
it('displays a blockie per the setting', () => {
const { container } = render({}, { useBlockie: true });
expect(container.querySelector('canvas')).toBeDefined();
expect(container.querySelector('img')).toBeDefined();
});
it('displays a jazzicon per the setting', () => {
const { container } = render({}, { useBlockie: false });
expect(container.querySelector('svg')).toBeDefined();
});
it('should show the address in the account button for multichain', () => {
const { getByText } = render({ showAddress: true });
expect(getByText('0x0DC...E7bc')).toBeInTheDocument();
});
});