1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 02:10:12 +01:00
metamask-extension/ui/components/component-library/header-base/header-base.test.tsx
George Marshall 739075662c
Migrating Icon to typescript and deprecating JS component (#18431)
* Migrating Icon to typescript and deprecating JS component

* gw suggestions (#18434)

---------

Co-authored-by: Garrett Bear <gwhisten@gmail.com>
2023-04-04 09:48:04 -07:00

62 lines
1.8 KiB
TypeScript

/* eslint-disable jest/require-top-level-describe */
import { render } from '@testing-library/react';
import React from 'react';
import { Icon, IconName } from '..';
import { HeaderBase } from './header-base';
describe('HeaderBase', () => {
it('should render HeaderBase element correctly', () => {
const { getByTestId, container } = render(
<HeaderBase data-testid="header-base" title="HeaderBase test">
should render HeaderBase element correctly
</HeaderBase>,
);
expect(getByTestId('header-base')).toHaveClass('mm-header-base');
expect(container).toMatchSnapshot();
});
it('should render with added classname', () => {
const { getByTestId } = render(
<HeaderBase
className="mm-header-base--test"
data-testid="header-base"
title="HeaderBase test"
>
should render HeaderBase element correctly
</HeaderBase>,
);
expect(getByTestId('header-base')).toHaveClass('mm-header-base--test');
});
it('should render HeaderBase children', () => {
const { getByText } = render(
<HeaderBase>HeaderBase children test</HeaderBase>,
);
expect(getByText('HeaderBase children test')).toBeDefined();
});
it('should render HeaderBase startAccessory', () => {
const { getByTestId } = render(
<HeaderBase
startAccessory={
<Icon data-testid="start-accessory" name={IconName.AddSquare} />
}
/>,
);
expect(getByTestId('start-accessory')).toBeDefined();
});
it('should render HeaderBase endAccessory', () => {
const { getByTestId } = render(
<HeaderBase
endAccessory={
<Icon data-testid="end-accessory" name={IconName.AddSquare} />
}
/>,
);
expect(getByTestId('end-accessory')).toBeDefined();
});
});