File size: 662 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
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);
});
|