Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
asimonok committed Apr 22, 2024
1 parent 6575e9b commit aaa354b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions src/components/FormElements/FormElements.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ describe('Form Elements', () => {
expect(selectors.fieldDateTime()).toHaveValue('2021-07-31 12:30:30');
});

it('should handle onChange event for time input', async () => {
it('Should handle onChange event for time input', async () => {
let appliedElements = [{ id: 'timeElement', type: FormElementType.TIME, value: '', disabled: false }];
const options = {
submit: {},
Expand All @@ -860,7 +860,11 @@ describe('Form Elements', () => {
*/
await act(() => fireEvent.change(selectors.fieldTimeInput(), { target: { value: '2024-04-10T12:30:00Z' } }));

expect(onChangeElement).toHaveBeenCalled();
expect(onChangeElement).toHaveBeenCalledWith(
expect.objectContaining({
value: '2024-04-10T12:30:00.000Z',
})
);
});

/**
Expand Down
2 changes: 1 addition & 1 deletion src/constants/form-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const FORM_ELEMENT_TYPE_OPTIONS: SelectableValue[] = [
},
{
value: FormElementType.TIME,
label: 'Time Input',
label: 'Time',
},
];

Expand Down
4 changes: 2 additions & 2 deletions src/utils/form-element.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,13 @@ describe('Utils', () => {
* Test toNumberValue function
*/
describe('toNumberValue', () => {
it('should convert non-empty string to number', () => {
it('Should convert non-empty string to number', () => {
expect(toNumberValue('123')).toEqual(123);
expect(toNumberValue('0')).toEqual(0);
expect(toNumberValue('-456')).toEqual(-456);
});

it('should return null for empty string', () => {
it('Should return null for empty string', () => {
expect(toNumberValue('')).toBeNull();
});
});
Expand Down

0 comments on commit aaa354b

Please sign in to comment.