[Vuejs]-How to test vuex state and mutations correctly?

0👍

On your test, you are setting your state showModal to true:

beforeEach(() => {
  state = {
    showModal: true
  }
  ...
})

So your overlay is rendered and that is why your test conditions resolves as true.

<div ref="modal" class="modal-overlay"
   v-if="isShow"
   @click="close">
 </div>
enter code here

Your ‘isShow’ computed value is point to the showModal = true on your test.

Leave a comment