Skip to content

Commit

Permalink
test(button): button test 파일 생성 및 test.yml파일 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
KimKyuHoi committed Dec 2, 2024
1 parent 1854f11 commit 2ac9911
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/ui/src/components/ui/button.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { Button } from './button';

describe('Button', () => {
it('renders correctly', () => {
render(<Button>Click me</Button>);
expect(screen.getByText('Click me')).toBeInTheDocument();
});

it('handles click events', async () => {
const handleClick = jest.fn();
render(<Button onClick={handleClick}>Click me</Button>);
await userEvent.click(screen.getByText('Click me'));
expect(handleClick).toHaveBeenCalled();
});

it('renders with variant classes', () => {
render(<Button variant="destructive">Delete</Button>);
expect(screen.getByText('Delete')).toHaveClass('bg-destructive');
});
});

0 comments on commit 2ac9911

Please sign in to comment.