mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 00:09:40 +02:00
feat(ui): write tests [EE-6685] (#11081)
This commit is contained in:
parent
2d25bf4afa
commit
4bf18b1d65
10 changed files with 232 additions and 15 deletions
26
app/react/components/Badge/Badge.test.tsx
Normal file
26
app/react/components/Badge/Badge.test.tsx
Normal file
|
@ -0,0 +1,26 @@
|
|||
import { render } from '@/react-tools/test-utils';
|
||||
|
||||
import { Badge } from './Badge';
|
||||
|
||||
test('should render a Badge component with default type', () => {
|
||||
const { getByText } = render(<Badge>Default Badge</Badge>);
|
||||
const badgeElement = getByText('Default Badge');
|
||||
expect(badgeElement).toBeInTheDocument();
|
||||
expect(badgeElement).toHaveClass('text-blue-9 bg-blue-2');
|
||||
});
|
||||
|
||||
test('should render a Badge component with custom type', () => {
|
||||
const { getByText } = render(<Badge type="success">Success Badge</Badge>);
|
||||
const badgeElement = getByText('Success Badge');
|
||||
expect(badgeElement).toBeInTheDocument();
|
||||
expect(badgeElement).toHaveClass('text-success-9 bg-success-2');
|
||||
});
|
||||
|
||||
test('should render a Badge component with custom className', () => {
|
||||
const { getByText } = render(
|
||||
<Badge className="custom-class">Custom Badge</Badge>
|
||||
);
|
||||
const badgeElement = getByText('Custom Badge');
|
||||
expect(badgeElement).toBeInTheDocument();
|
||||
expect(badgeElement).toHaveClass('custom-class');
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue