@vergiss/chooks
Version:
React hooks library
18 lines • 625 B
JavaScript
import { act, renderHook } from '@testing-library/react-hooks';
import { usePageTitle } from '../index';
describe('usePageTitle', function () {
it('should be defined', function () {
expect(usePageTitle).toBeDefined();
});
it("should change document's title and restore while unmounting", function () {
global.window.document.title = 'Hello';
var hook = renderHook(function () {
return usePageTitle('Hello World');
});
expect(global.window.document.title).toBe('Hello World');
act(function () {
hook.unmount();
});
expect(global.window.document.title).toBe('Hello');
});
});