Mangesh Daundkar
Mangesh Daundkar

Reputation: 1046

VueJS Unit Test Error - Not implemented: window.open

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

Answers (1)

Jongho Lee
Jongho Lee

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

Related Questions