-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Unit tests for CheckoutSummary component (#11061)
* test: Unit tests for CheckoutSummary component * Added changeset: Unit tests for CheckoutSummary component
- Loading branch information
1 parent
7a2e989
commit 194d9d4
Showing
3 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
45 changes: 45 additions & 0 deletions
45
packages/manager/src/components/CheckoutSummary/CheckoutSummary.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters