Mock window.scroll - otherwise JSDOM prints a not-implemented error

This commit is contained in:
Vesa Luusua 2019-05-03 01:35:52 +03:00
parent 537c001e2f
commit 5cd7ba5afc

View file

@ -15,6 +15,16 @@ const render = (url, context) => {
return { head, body };
};
const jsdomScroll = window.scroll;
beforeAll(() => {
// Mock window.scroll - otherwise, Jest/JSDOM will print a not-implemented error.
window.scroll = () => {};
});
afterAll(() => {
window.scroll = jsdomScroll;
});
describe('Application', () => {
it('renders in the client without crashing', () => {
window.google = { maps: {} };