tests
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import React from 'react';
|
||||
import { render, screen, fireEvent } from '@testing-library/react';
|
||||
import ActionButton from '../src/components/account/ActionButton.jsx';
|
||||
|
||||
describe('ActionButton Component', () => {
|
||||
it('should render with the correct title and call the action when clicked', () => {
|
||||
const mockAction = jest.fn();
|
||||
const title = 'Click Me';
|
||||
|
||||
render(<ActionButton action={mockAction} title={title} />);
|
||||
|
||||
const buttonElement = screen.getByText(title);
|
||||
expect(buttonElement).toBeInTheDocument();
|
||||
|
||||
fireEvent.click(buttonElement);
|
||||
expect(mockAction).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user