Automation validations mixin spec

This commit is contained in:
Fayaz Ahmed 2022-05-19 17:57:22 +05:30
parent 4ac4ac49dd
commit 5056303156

View file

@ -1,4 +1,5 @@
import methodsMixin from '../../../dashboard/mixins/automations/methodsMixin';
import validationsMixin from '../../../dashboard/mixins/automations/validationsMixin';
import {
automation,
customAttributes,
@ -31,13 +32,20 @@ localVue.use(Vuex);
import Vuelidate from 'vuelidate';
Vue.use(Vuelidate);
const createComponent = (mixins, data, computed = {}, methods = {}) => {
const createComponent = (
mixins,
data,
computed = {},
methods = {},
validations
) => {
const Component = {
render() {},
mixins,
data,
computed,
methods,
validations,
};
const Constructor = Vue.extend(Component);
const vm = new Constructor().$mount();
@ -85,7 +93,7 @@ const generateComputedProperties = () => {
};
};
describe('automationMixin', () => {
describe('automationMethodsMixin', () => {
it('getFileName returns the correct file name', () => {
const data = () => {
return {};
@ -476,3 +484,13 @@ describe('automationMixin', () => {
);
});
});
describe('automationValidationsMixin', () => {
it('automationValidationsMixin is present', () => {
const data = () => {
return {};
};
const wrapper = createComponent([validationsMixin], data, {}, {});
expect(typeof wrapper.vm.$options.validations).toBe('object');
});
});