Currently, I am testing a method that includes locking the orientation of the screen as one of its functionalities. However, when using Jasmine, I encountered an error at the following line:
(<any>window).screen.orientation.lock('portrait')
indicating that undefined is not a constructor
.
I attempted to use window.screen methods without TypeScript types by using
window.screen.msOrientationLock('landscape')
and other similar methods but still faced the same error. I have also injected _$window_ in the beforeEach
block of my tests.
It's worth noting that checking if it locks is not essential for my test. Is there a way to skip this specific line or resolve this error? Thank you :)