[Vuejs]-How to Pinia Test => Method calling another => toHaveBeenCalledTimes?

0👍

The use of Pinia setup function instead of setup options limits the testability. increaseBy11 refers local increaseBy10 function, there’s no way how it could be spied or mocked outside setup function scope.

This won’t happen if actions are consistently referred as this methods:

actions: 
  increaseBy10() {
    this.count += 10
  },
  increaseBy11() {
    this.increment()
    this.increaseBy10()
  },
  ...

Leave a comment