A
A
Artur Galyaev2021-01-23 19:18:07
Vue.js
Artur Galyaev, 2021-01-23 19:18:07

[Vue warn]: Invalid Component definition, how to fix?

console.error node_modules/vue/dist/vue.runtime.common.dev.js:621
    [Vue warn]: Invalid Component definition:

    found in

    ---> <PlannedBudget>
           <Root>


Test code:

import { shallowMount, createLocalVue } from "@vue/test-utils"
import "../../config.js"
import PlannedBudget from "COMPONENT.vue"
import BudgetModule from "../../store/budget/mock"
import Vuex from "vuex"
import Vue from 'vue'

const localVue = createLocalVue()
Vue.use(Vuex)

describe("tests", () => {
    let store
    let wrapper
    beforeEach(() => {
        store = new Vuex.Store({
            modules: {
                budget: {
                    namespaced: true,
                    ...BudgetModule
                }
            }
        })
        wrapper = shallowMount(PlannedBudget, { localVue, store })
    })
    it("open on click", async () => {
        await wrapper.find(".total div").trigger("click")
        let opennedWrapper = wrapper.find(".total-open")
        expect(opennedWrapper.exists()).toBeTruthy()
    })
    it("close", async () => {
        await wrapper.find(".total div").trigger("click")
        await wrapper.find(".total__close").trigger("click")
        expect(wrapper.find(".total-open").exists()).toBeFalsy()
    })
})

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question