Skip to content

Instantly share code, notes, and snippets.

@niinpatel
Created February 25, 2019 15:10
Show Gist options
  • Save niinpatel/afea86d50ac4417a5192a9545b7ece76 to your computer and use it in GitHub Desktop.
Save niinpatel/afea86d50ac4417a5192a9545b7ece76 to your computer and use it in GitHub Desktop.
import { act } from 'react-dom/test-utils';
import { testHook } from './testUtils';
import useTextField from '../useTextField';
let nameField;
beforeEach(() => {
testHook(() => {
nameField = useTextField('name');
});
});
describe('useTextField', () => {
test('should have an onChange function', () => {
expect(nameField.onChange).toBeInstanceOf(Function);
});
test('should have correct name', () => {
expect(nameField.name).toBe('name');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment