diff --git a/packages/manager/.changeset/pr-11222-added-1730959236426.md b/packages/manager/.changeset/pr-11222-added-1730959236426.md new file mode 100644 index 00000000000..0019a20f8ff --- /dev/null +++ b/packages/manager/.changeset/pr-11222-added-1730959236426.md @@ -0,0 +1,5 @@ +--- +"@linode/manager": Added +--- + +unit test cases for EntityHeader component ([#11222](https://github.com/linode/manager/pull/11222)) diff --git a/packages/manager/src/components/EntityHeader/EntityHeader.test.tsx b/packages/manager/src/components/EntityHeader/EntityHeader.test.tsx new file mode 100644 index 00000000000..fb71431f560 --- /dev/null +++ b/packages/manager/src/components/EntityHeader/EntityHeader.test.tsx @@ -0,0 +1,40 @@ +import React from 'react'; + +import { renderWithTheme } from 'src/utilities/testHelpers'; + +import { EntityHeader } from './EntityHeader'; + +import { HeaderProps } from './EntityHeader'; + +const mockText = 'Hello world'; + +const defaultProps: HeaderProps = { + title: mockText, +}; + +describe('EntityHeader', () => { + it('should render title with variant when isSummaryView is True', () => { + const { getByRole } = renderWithTheme( + + ); + const heading = getByRole('heading', { level: 2 }); + expect(heading).toBeInTheDocument(); + expect(heading).toHaveTextContent(mockText); + }); + + it('should not render title when isSummaryView is False', () => { + const { queryByText } = renderWithTheme( + + ); + expect(queryByText(mockText)).not.toBeInTheDocument(); + }); + + it('should render children if provided', () => { + const { getByText } = renderWithTheme( + +
Child items can go here!
+
+ ); + expect(getByText('Child items can go here!')).toBeInTheDocument(); + }); +});