From: Eduardo San Martin Morote Date: Mon, 3 May 2021 09:21:17 +0000 (+0200) Subject: test: test warn mapStores X-Git-Tag: v0.4.0~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22c38f40ea1c49a312cfbf440477d00d1afa2746;p=thirdparty%2Fvuejs%2Fpinia.git test: test warn mapStores --- 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', () => {