Download react-hook-form/src/__tests__/logic/getEventValue.test.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 662 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-hook-form/src/__tests__/logic/getEventValue.test.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/react-hook-form/src/__tests__/logic/getEventValue.test.ts
-
curl -L -o getEventValue.test.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-hook-form/src/__tests__/logic/getEventValue.test.ts
662 Bytes
| import getEventValue from '../../logic/getEventValue'; | |
| test('getEventValue should return correct value', () => { | |
| expect( | |
| getEventValue({ | |
| target: { checked: true, type: 'checkbox' }, | |
| }), | |
| ).toEqual(true); | |
| expect( | |
| getEventValue({ | |
| target: { checked: true, type: 'checkbox', value: 'test' }, | |
| }), | |
| ).toEqual(true); | |
| expect(getEventValue({ target: { value: 'test' }, type: 'test' })).toEqual( | |
| 'test', | |
| ); | |
| expect(getEventValue({ data: 'test' })).toEqual({ data: 'test' }); | |
| expect(getEventValue('test')).toEqual('test'); | |
| expect(getEventValue(undefined)).toEqual(undefined); | |
| expect(getEventValue(null)).toEqual(null); | |
| }); | |