Files
frontend-app-gradebook/src/components/GradesView/EditModal/OverrideTable/ReasonInput/index.test.jsx
2025-09-08 14:57:00 -04:00

32 lines
831 B
JavaScript

import { render, screen } from '@testing-library/react';
import useReasonInputData from './hooks';
import ReasonInput from '.';
jest.mock('./hooks', () => jest.fn());
const hookProps = {
ref: jest.fn().mockName('hook.ref'),
onChange: jest.fn().mockName('hook.onChange'),
value: 'test-value',
};
useReasonInputData.mockReturnValue(hookProps);
describe('ReasonInput component', () => {
beforeEach(() => {
jest.clearAllMocks();
render(<ReasonInput />);
});
describe('behavior', () => {
it('initializes hook data', () => {
expect(useReasonInputData).toHaveBeenCalled();
});
});
describe('renders', () => {
it('input correctly', () => {
expect(screen.getByRole('textbox')).toBeInTheDocument();
expect(screen.getByRole('textbox')).toHaveValue(hookProps.value);
});
});
});