From 19ba385e46790876f9dbc84b6917b60e7d993ee6 Mon Sep 17 00:00:00 2001 From: elweyn Date: Sun, 23 Jul 2023 18:58:12 +0200 Subject: [PATCH] Test UserQuery to get jest line check. --- admin/src/components/UserQuery.spec.js | 50 ++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 admin/src/components/UserQuery.spec.js diff --git a/admin/src/components/UserQuery.spec.js b/admin/src/components/UserQuery.spec.js new file mode 100644 index 000000000..2d6a6c554 --- /dev/null +++ b/admin/src/components/UserQuery.spec.js @@ -0,0 +1,50 @@ +import { mount } from '@vue/test-utils' +import UserQuery from './UserQuery' +import flushPromises from 'flush-promises' + +const localVue = global.localVue + +const propsData = { + userId: 42, +} +const mocks = { + $t: jest.fn((t) => t), +} +describe('TransactionLinkList', () => { + let wrapper + + const Wrapper = () => { + return mount(UserQuery, { mocks, localVue, propsData }) + } + + describe('mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('has div .input-group', () => { + expect(wrapper.find('div .input-group').exists()).toBe(true) + }) + + it('has .test-input-criteria', () => { + expect(wrapper.find('input.test-input-criteria').exists()).toBe(true) + }) + + describe('has', () => { + beforeEach(async () => { + await wrapper.find('input.test-input-criteria').setValue('Test2') + await wrapper.find('input.test-input-criteria').trigger('blur') + await flushPromises() + await wrapper.vm.$nextTick() + }) + + it('emits input', () => { + expect(wrapper.emitted('input')).toBeTruthy() + }) + + it('emits input with value "Test2"', () => { + expect(wrapper.emitted('input')).toEqual([['Test2']]) + }) + }) + }) +})