chai
chai copied to clipboard
how to check component methods calledOnce
Your document is not clear of testing vue component methods.
I need to check how many times a component method has been called (or) need to check whether the method has been called or not.
Have a look at chai-spies for this. It's a plugin which allows you to do something like this:
const chai = require('chai');
const chaiSpies = require('chai-spies');
chai.use(chaiSpies);
let vm = new Vue({ ... });
chai.spy.on(vm, 'someMethod');
doSomething();
expect(vm.someMethod).to.have.been.called();