mirror of
https://github.com/streamich/react-use.git
synced 2026-01-18 14:06:52 +00:00
chore: move all the tests to the separate directory outside of sources; chore: remove jest.config.js (config moved to the package.json); test: unused import in test; test: 💍 fix tests add back x and y to useMeasure chore: 🤖 add linter to /tests folder ci: 🎡 limit Jest worker count for CircleCI
17 lines
500 B
TypeScript
17 lines
500 B
TypeScript
import { renderHook } from '@testing-library/react-hooks';
|
|
import useTitle from '../src/useTitle';
|
|
|
|
describe('useTitle', () => {
|
|
it('should be defined', () => {
|
|
expect(useTitle).toBeDefined();
|
|
});
|
|
|
|
it('should update document title', () => {
|
|
const hook = renderHook(props => useTitle(props), { initialProps: 'My page title' });
|
|
|
|
expect(document.title).toBe('My page title');
|
|
hook.rerender('My other page title');
|
|
expect(document.title).toBe('My other page title');
|
|
});
|
|
});
|