From 22c38f40ea1c49a312cfbf440477d00d1afa2746 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Mon, 3 May 2021 11:21:17 +0200 Subject: [PATCH] test: test warn mapStores --- __tests__/mapHelpers.spec.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/__tests__/mapHelpers.spec.ts b/__tests__/mapHelpers.spec.ts index e86df276..f8ec2a0c 100644 --- a/__tests__/mapHelpers.spec.ts +++ b/__tests__/mapHelpers.spec.ts @@ -14,6 +14,7 @@ import VueCompositionAPI, { nextTick, defineComponent, } from '@vue/composition-api' +import { mockWarn } from 'jest-mock-warn' describe('Map Helpers', () => { const useCartStore = defineStore({ id: 'cart' }) @@ -43,6 +44,7 @@ describe('Map Helpers', () => { localVue.use(PiniaPlugin) describe('mapStores', () => { + mockWarn() it('mapStores computes only once when mapping one store', async () => { const pinia = createPinia() const fromStore = jest.fn(function () { @@ -128,6 +130,11 @@ describe('Map Helpers', () => { await wrapper.trigger('click') expect(wrapper.text()).toBe('2') }) + + it('should warn when an array is passed', () => { + mapStores([]) + expect('pass all stores to "mapStores()"').toHaveBeenWarned() + }) }) it('mapGetters', () => { -- 2.47.3