Reputation: 1046
I'm trying to write unit test using chai and mocha.But getting this error while running test. Can anyone please help me here.
Upvotes: 1
Views: 1041
Reputation: 101
You can mock your window.open function like this.
it ('function with window.open', (done) => {
window.open = function(url) {
// you can define your own window.open function
expect(url).toBe(originUrl);
done();
};
});
Good luck!
Upvotes: 2