mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
ff96836871
* Add updated version of the Snaps list UI Add more changes to match the designs of snaps list Add next design iteration for snaps list Update icons, sizes and pointer behaviour Add redesign for snap settings page Refactor and improve designs Fix unit tests and refactor code Fix e2e test Fix lint Update margin values Add CSS override for connected sites list and update margins Update paddings as requested Fix vertical alignment of links Fix tooltip position on the enable button Add usage of getSnapName function for displaying snap names Fix e2e tests and update date format for snap install date Improve unit test for snap-settings-card Change installation info logic Update mocked state for snap Add tests for ViewSnap component, refactor and update mocked state Add check for version info Change Snaps icon in Settings Refactor Snaps list to use selector Add handling in case of missing version history * Fix icon ref * Remove console logs * Remove onClick from selector * Add code fencing for imports in selectors.js
47 lines
1.5 KiB
JavaScript
47 lines
1.5 KiB
JavaScript
import * as React from 'react';
|
|
import { screen } from '@testing-library/react';
|
|
import configureMockStore from 'redux-mock-store';
|
|
import thunk from 'redux-thunk';
|
|
import { renderWithProvider } from '../../../../../test/lib/render-helpers';
|
|
import mockState from '../../../../../test/data/mock-state.json';
|
|
import SnapSettingsCard from '.';
|
|
|
|
describe('SnapSettingsCard', () => {
|
|
const args = {
|
|
name: 'Snap name',
|
|
packageName: '@metamask/test-snap-bip44',
|
|
snapId: 'npm:@metamask/test-snap-bip44',
|
|
onClick: () => null,
|
|
};
|
|
const mockStore = configureMockStore([thunk])(mockState);
|
|
|
|
it('should render the SnapsSettingCard without crashing', () => {
|
|
const { getByText } = renderWithProvider(
|
|
<SnapSettingsCard {...args} />,
|
|
mockStore,
|
|
);
|
|
expect(getByText('Snap name')).toBeDefined();
|
|
});
|
|
|
|
it('should render the icon fallback using the first letter of the name', async () => {
|
|
const { getByText } = renderWithProvider(
|
|
<SnapSettingsCard {...args} icon="" />,
|
|
mockStore,
|
|
);
|
|
|
|
const avatar = await screen.findAllByText(/B/u);
|
|
avatar.forEach((avatarBaseElement) => {
|
|
expect(avatarBaseElement).toHaveClass('mm-avatar-base');
|
|
});
|
|
expect(getByText('B')).toBeDefined();
|
|
});
|
|
|
|
it('should render the package name', () => {
|
|
const { getByText } = renderWithProvider(
|
|
<SnapSettingsCard {...args} icon="" />,
|
|
mockStore,
|
|
);
|
|
expect(getByText('@metamask/test-snap-bip44')).toBeDefined();
|
|
});
|
|
});
|