diff --git a/packages/manager/.changeset/pr-11061-tests-1728374977579.md b/packages/manager/.changeset/pr-11061-tests-1728374977579.md new file mode 100644 index 00000000000..7abb4ff92b9 --- /dev/null +++ b/packages/manager/.changeset/pr-11061-tests-1728374977579.md @@ -0,0 +1,5 @@ +--- +"@linode/manager": Tests +--- + +Unit tests for CheckoutSummary component ([#11061](https://github.com/linode/manager/pull/11061)) diff --git a/packages/manager/src/components/CheckoutSummary/CheckoutSummary.test.tsx b/packages/manager/src/components/CheckoutSummary/CheckoutSummary.test.tsx new file mode 100644 index 00000000000..87358eb0024 --- /dev/null +++ b/packages/manager/src/components/CheckoutSummary/CheckoutSummary.test.tsx @@ -0,0 +1,45 @@ +import React from 'react'; + +import { renderWithTheme } from 'src/utilities/testHelpers'; + +import { CheckoutSummary } from './CheckoutSummary'; + +import type { CheckoutSummaryProps } from './CheckoutSummary'; + +const defaultArgs: CheckoutSummaryProps = { + displaySections: [ + { title: 'Debian 11' }, + { details: '$36/month', title: 'Dedicated 4GB' }, + ], + heading: 'Checkout Summary', +}; + +describe('CheckoutSummary', () => { + it('should render heading and display section', () => { + const { getByText } = renderWithTheme(); + + expect(getByText('Checkout Summary')).toBeVisible(); + expect(getByText('Debian 11')).toBeVisible(); + }); + + it('should render children if provided', () => { + const { getByText } = renderWithTheme( + +
Child items can go here!
+
+ ); + + expect(getByText('Child items can go here!')).toBeInTheDocument(); + }); + + it('should render agreement if provided', () => { + const { getByText } = renderWithTheme( + Agreement item can go here!} + /> + ); + + expect(getByText('Agreement item can go here!')).toBeInTheDocument(); + }); +}); diff --git a/packages/manager/src/components/CheckoutSummary/CheckoutSummary.tsx b/packages/manager/src/components/CheckoutSummary/CheckoutSummary.tsx index a272a3536c5..a1d7873b0b5 100644 --- a/packages/manager/src/components/CheckoutSummary/CheckoutSummary.tsx +++ b/packages/manager/src/components/CheckoutSummary/CheckoutSummary.tsx @@ -10,7 +10,7 @@ import { SummaryItem } from './SummaryItem'; import type { Theme } from '@mui/material/styles'; -interface CheckoutSummaryProps { +export interface CheckoutSummaryProps { /** * JSX element to be displayed as an agreement section. */