@cnamts/form-builder
Version:
FormBuilder for the French Health Insurance
31 lines (23 loc) • 654 B
text/typescript
import Vue from 'vue';
import { mount, Wrapper } from '@vue/test-utils';
import { FieldMap } from '../fieldMap';
/** Create the wrapper */
function createWrapper() {
const component = Vue.component('TestComponent', {
mixins: [
FieldMap
],
template: '<div />'
});
return mount(component) as Wrapper<FieldMap>;
}
describe('FieldMap', () => {
it('contains the map of fields and their components', () => {
const wrapper = createWrapper();
expect(wrapper.vm.fieldMap).toMatchSnapshot();
});
it('gets a field component', () => {
const wrapper = createWrapper();
expect(typeof wrapper.vm.getField('text')).toBe('string');
});
});