Skip to content

Commit

Permalink
Add test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmale committed Oct 3, 2024
1 parent 873a615 commit b473b72
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/components/inputs/number/number.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ describe('NumberField Component', () => {
expect(screen.getByLabelText('Weight(kg):')).toBeInTheDocument();
});

it('should render with NaN value', async () => {
await renderNumberField({
field: numberFieldMock,
value: NaN,
errors: [],
warnings: [],
setFieldValue: jest.fn(),
});

const inputElement = screen.getByLabelText('Weight(kg):') as HTMLInputElement;
expect(inputElement.value).toBe('');
});

it('calls setFieldValue on input change', async () => {
const mockSetFieldValue = jest.fn();

Expand Down

0 comments on commit b473b72

Please sign in to comment.