mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-08 01:15:49 +02:00
Adds a Biome rule for "no unused imports", which is something we sometimes have trouble catching. We're adding this as a warning for now. It is safely and easily fixable with `yarn lint:fix`.  
32 lines
1004 B
TypeScript
32 lines
1004 B
TypeScript
import { vi } from 'vitest';
|
|
import { fireEvent, screen } from '@testing-library/react';
|
|
import { render } from 'utils/testRenderer';
|
|
import { ChangeRequestRejectDialogue } from './ChangeRequestRejectDialog';
|
|
|
|
describe('<ChangeRequestRejectDialogue />', () => {
|
|
test('submits the typed comment to onConfirm', () => {
|
|
const handleConfirm = vi.fn();
|
|
const handleClose = vi.fn();
|
|
|
|
render(
|
|
<ChangeRequestRejectDialogue
|
|
open={true}
|
|
onConfirm={handleConfirm}
|
|
onClose={handleClose}
|
|
/>,
|
|
);
|
|
|
|
const commentInput = screen.getByPlaceholderText(
|
|
'Add your comment here',
|
|
);
|
|
fireEvent.change(commentInput, { target: { value: 'Test Comment' } });
|
|
|
|
const rejectButton = screen.getByRole('button', {
|
|
name: /Reject changes/i,
|
|
});
|
|
fireEvent.click(rejectButton);
|
|
|
|
expect(handleConfirm).toHaveBeenCalledWith('Test Comment');
|
|
});
|
|
});
|