UNPKG

@maxpike/vue

Version:

Vue VariantJS: Fully configurable Vue 3 components styled with TailwindCSS

41 lines (33 loc) 970 B
import { shallowMount } from '@vue/test-utils'; import { defineComponent } from 'vue'; import useInjectsConfiguration from '../../use/useInjectsConfiguration'; describe('useInjectsConfiguration', () => { const configurationToProvide = { name: 'test', foo: 'bar', classesList: { test: 'test', }, }; const component = defineComponent({ setup() { const configuration = useInjectsConfiguration(); return { configuration }; }, template: '<div />', }); it('returns the provided configuration option', () => { const wrapper = shallowMount(component, { global: { provide: { configuration: configurationToProvide, }, }, }); expect(wrapper.vm.configuration).toEqual(configurationToProvide); }); it('returns the an empty configuration if no provide', () => { const wrapper = shallowMount(component); expect(wrapper.vm.configuration).toEqual({}); }); });