Questions tagged [vue-test-utils]

Helpers to render VueJS components in unit tests.

Toolset to make complete or shallow rendering VueJS components while writing unit tests. Can be run under Jest or Mocha test runners. See vue-test-utils.vuejs.org for details.

814 questions
0
votes
1 answer

How to test the access of protected route guard with in Vuejs?

I implemented a route guard to protect the /settings route with the vue-router method beforeEnter(). I try to test that the route is protected to admins only. I am using Vuejs 2, Vue-router, Vuex and vue-test-utils. router.js import Vue from…
Simon Thiel
  • 2,888
  • 6
  • 24
  • 46
0
votes
1 answer

How do I mock a module that is minified?

I created a component to be used as a package. We are using third party code supplied to us, a config file (initOpinionLab.js) and a .min.js file (opinionlab.min.js). I am trying to write unit tests for my component. A module that index.js is…
Kevin T.
  • 668
  • 3
  • 12
  • 29
0
votes
1 answer

How to test that a Vue directives is called on hover/mouseover?

I try to test that theb-tooltip.hover directive from bootstrap-vue is called on hover. It seems that the directive is called even without triggering the hover event andbuttonWrapper.trigger('mouseover'); doesn't show any effect. How can I trigger…
Simon Thiel
  • 2,888
  • 6
  • 24
  • 46
0
votes
1 answer

How to write a unit test with data fetching, that alters data based on respone in vuejs?

I am trying to write a unit test for a function that does an async call, but it doesnt seem to alter the data prop, maybe I am doing something wrong. Check the code below: getSomething() { MyService.getThis().then( response => { …
Moddah
  • 51
  • 1
  • 7
0
votes
1 answer

Testing that a method is called when component is mounted

I'm trying to test that a method gets called when a component is mounted but it keeps failing with Expected mock function to have been called one time, but it was called zero times. Here is the component: