1
0
mirror of synced 2024-11-22 13:26:06 +03:00

test: Improved checking validation event & code style

This commit is contained in:
Zaytsev Kirill 2021-05-22 15:29:01 +03:00
parent cb2f350edf
commit 4cec18b1d7
2 changed files with 4 additions and 5 deletions

View File

@ -320,7 +320,7 @@ describe('FormularioForm', () => {
expect(wrapper.vm.mergedFieldErrors.inputB.length).toBe(2) expect(wrapper.vm.mergedFieldErrors.inputB.length).toBe(2)
}) })
it('Emits correct validation event when no errors', async () => { it('emits correct validation event when no errors', async () => {
const wrapper = mount(FormularioForm, { const wrapper = mount(FormularioForm, {
slots: { slots: {
default: ` default: `
@ -337,11 +337,10 @@ describe('FormularioForm', () => {
await flushPromises() await flushPromises()
expect(wrapper.emitted('validation')).toBeTruthy() expect(wrapper.emitted('validation')).toBeTruthy()
expect(wrapper.emitted('validation').length).toBe(1) expect(wrapper.emitted('validation')).toEqual([[{
expect(wrapper.emitted('validation')[0][0]).toEqual({
name: 'foo', name: 'foo',
violations: [], violations: [],
}) }]])
}) })
it('Emits correct validation event on entry', async () => { it('Emits correct validation event on entry', async () => {

View File

@ -6,7 +6,7 @@ import Formulario from '@/index.ts'
import FormularioForm from '@/FormularioForm.vue' import FormularioForm from '@/FormularioForm.vue'
import FormularioInput from '@/FormularioInput.vue' import FormularioInput from '@/FormularioInput.vue'
const globalRule = jest.fn(() => { return false }) const globalRule = jest.fn(() => false)
Vue.use(Formulario, { Vue.use(Formulario, {
validationRules: { globalRule }, validationRules: { globalRule },