Skip to content

Commit 8a63a81

Browse files
committed
test(amazonq): add mock for IntersectionObserver
1 parent f0e16c4 commit 8a63a81

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/amazonq/test/e2e/amazonq/framework/jsdomInjector.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,16 @@ export function injectJSDOM() {
4848
// jsdom doesn't have support for structuredClone. See https://github.com/jsdom/jsdom/issues/3363
4949
global.structuredClone = (val: any) => JSON.parse(JSON.stringify(val))
5050
}
51+
52+
global.IntersectionObserver = class IntersectionObserver {
53+
observe() {}
54+
unobserve() {}
55+
disconnect() {}
56+
takeRecords() {
57+
return []
58+
}
59+
// eslint-disable-next-line unicorn/no-null
60+
root = null
61+
rootMargin = ''
62+
thresholds = []
63+
}

0 commit comments

Comments
 (0)