Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11061-tests-1728374977579.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tests
---

Unit tests for CheckoutSummary component ([#11061](https://github.com/linode/manager/pull/11061))
Original file line number Diff line number Diff line change
@@ -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(<CheckoutSummary {...defaultArgs} />);

expect(getByText('Checkout Summary')).toBeVisible();
expect(getByText('Debian 11')).toBeVisible();
});

it('should render children if provided', () => {
const { getByText } = renderWithTheme(
<CheckoutSummary {...defaultArgs}>
<div>Child items can go here!</div>
</CheckoutSummary>
);

expect(getByText('Child items can go here!')).toBeInTheDocument();
});

it('should render agreement if provided', () => {
const { getByText } = renderWithTheme(
<CheckoutSummary
{...defaultArgs}
agreement={<div>Agreement item can go here!</div>}
/>
);

expect(getByText('Agreement item can go here!')).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down