Estoy usando Quasar, vue y vuex. Creé un diseño y me gustaría usar jest para la prueba unitaria. He estado copiando fragmentos de mi código de diseño y ejecutando pruebas a medida que avanzo.
Este es mi código de especificación
import MainLayout from "../../../src/layouts/test"; import { mountFactory } from "@quasar/quasar-app-extension-testing-unit-jest"; import { QLayout, QHeader, QToolbar, QBtn, QToolbarTitle, QImg } from "quasar"; const factory = mountFactory(MainLayout, { mount: { type: "full" }, quasar: { components: { QLayout, QHeader, QToolbar, QBtn, QToolbarTitle, QImg }, }, }); describe("test", () => { it("Show leftdrawer if leftDrawer is true", async () => { const wrapper = factory(MainLayout); await wrapper.vm.$nextTick(); expect(wrapper.findComponent("button").isVisible()).toBe(true); }); }); When I add this part in my MainLayout.vue <div v-if="!isAuthenticated"> <q-btn @click="goTo('signin')" outline roundeded label="sign in" name="signin" class="q-mr-sm" >y esta parte
computed: { ...mapState("member", { isAuthenticated: (state: MemberState) => state.isAuthenticated, })},
Recibo este error al probar TypeError: no se pueden leer las propiedades de undefined (leyendo 'estado')
...mapState("member", { isAuthenticated: (state: MemberState) => state.isAuthenticated, })¿Cómo configuro mi archivo de especificaciones para que se lea isAuthenticated from state in store?