[Vuejs]-Testing that a method is called when component is mounted

-1👍

mocks option mocks instance properties. mocks: { methods } assumes that there’s methods property in Vue component. Since this.methods.searchJobs() isn’t called, the test fails.

It’s searchJobs method, the test should be as the working snippet shows:

shallowMount(JobSearchTest, {
  methods: {
    searchJobs
  },
  localVue })

Leave a comment