From 5cd7ba5afcfe41de68994e1ec86007e19eb71032 Mon Sep 17 00:00:00 2001 From: Vesa Luusua Date: Fri, 3 May 2019 01:35:52 +0300 Subject: [PATCH] Mock window.scroll - otherwise JSDOM prints a not-implemented error --- src/app.test.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/app.test.js b/src/app.test.js index e52720e6..e666696b 100644 --- a/src/app.test.js +++ b/src/app.test.js @@ -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: {} };