From 980005f808ea3727f74f0622ebdfdfa035408669 Mon Sep 17 00:00:00 2001 From: Laila Los <44241786+ElectronicBlueberry@users.noreply.github.com> Date: Mon, 26 Feb 2024 16:39:19 +0100 Subject: [PATCH] add mock IntersectionObserver --- client/tests/jest/jest-environment.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/tests/jest/jest-environment.js b/client/tests/jest/jest-environment.js index cb044383bc8..4664dbc122b 100644 --- a/client/tests/jest/jest-environment.js +++ b/client/tests/jest/jest-environment.js @@ -2,12 +2,21 @@ import "jsdom-worker"; import JSDOMEnvironment from "jest-environment-jsdom"; +class MockObserver { + constructor(...args) {} + + observe(...args) {} + unobserve(...args) {} +} + export default class CustomJSDOMEnvironment extends JSDOMEnvironment { constructor(...args) { super(...args); this.global.Worker = Worker; + this.global.IntersectionObserver = MockObserver; + // FIXME https://github.com/jsdom/jsdom/issues/3363 this.global.structuredClone = structuredClone; }