import 'jest-preset-angular/setup-jest' ; class FakeIntersectionObserver { readonly callback : IntersectionObserverCallback ; constructor ( callback , options ? ) { this . callback = callback ; } observe ( target ) { const ary = [ ] ; const obj = { boundingClientRect : undefined , intersectionRect : undefined , rootBounds : undefined , time : 60 , intersectionRatio : 1 , target , isIntersecting : true , } ; ary [ 0 ] = obj ; const callback = ( ) => { } ; const observer = new IntersectionObserver ( callback ) ; this . callback ( ary , observer ) ; } unobserve ( target ) { } disconnect ( ) { } } Object . defineProperty ( window , 'IntersectionObserver' , { value : FakeIntersectionObserver , writable : true , } ) ;