1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-30 08:09:15 +01:00
metamask-extension/ui/components/component-library/base-avatar/base-avatar.test.js
Nidhi Kumari 194f7c8dd8
added AvatarBase Component (#15307)
* added AvatarBase Component

* added README file to storybook

* converted avatar-base to base-avatar

* props for snapshot testing

* replaced snapshot testing

* Updates to stories and component

* used arrow function for component

* fixed merge conflicts

* removed box stories

* changed import order for scss files

* replaced base-avatar import with component scss file

Co-authored-by: georgewrmarshall <george.marshall@consensys.net>
2022-08-01 15:14:33 +05:30

29 lines
1.2 KiB
JavaScript

/* eslint-disable jest/require-top-level-describe */
import { render } from '@testing-library/react';
import React from 'react';
import { BaseAvatar } from './base-avatar';
describe('BaseAvatar', () => {
it('should render correctly', () => {
const { getByTestId } = render(<BaseAvatar data-testid="base-avatar" />);
expect(getByTestId('base-avatar')).toBeDefined();
});
it('should render with different size classes', () => {
const { getByTestId } = render(
<>
<BaseAvatar size="xs" data-testid="base-avatar-xs" />
<BaseAvatar size="sm" data-testid="base-avatar-sm" />
<BaseAvatar size="md" data-testid="base-avatar-md" />
<BaseAvatar size="lg" data-testid="base-avatar-lg" />
<BaseAvatar size="xl" data-testid="base-avatar-xl" />
</>,
);
expect(getByTestId('base-avatar-xs')).toHaveClass('base-avatar--size-xs');
expect(getByTestId('base-avatar-sm')).toHaveClass('base-avatar--size-sm');
expect(getByTestId('base-avatar-md')).toHaveClass('base-avatar--size-md');
expect(getByTestId('base-avatar-lg')).toHaveClass('base-avatar--size-lg');
expect(getByTestId('base-avatar-xl')).toHaveClass('base-avatar--size-xl');
});
});