Automation validations mixin spec
This commit is contained in:
parent
4ac4ac49dd
commit
5056303156
1 changed files with 20 additions and 2 deletions
|
@ -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');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue