In my current project, I have a function that I need to write unit tests for. Within this function, I am comparing the global objects window
and parent
using
const isEqual = (window === parent)
.
I am wondering what would be the most effective way to mock these objects in an Angular/TypeScript environment.
One idea is to pass these objects as parameters to the function, but this approach does not fully address the issue since I still need to figure out how to mock the global window
object when using something like
getSomeData(win: Window, parent: Window) { // ... }
.