From 11a222749d09e278c263fcb5201340146debb6bc Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 3 Jan 2023 15:07:36 +0100 Subject: [PATCH] add test InputHour.spec.js --- .../src/components/Inputs/InputHour.spec.js | 46 +++++++++++++++++++ frontend/src/components/Inputs/InputHour.vue | 2 +- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 frontend/src/components/Inputs/InputHour.spec.js diff --git a/frontend/src/components/Inputs/InputHour.spec.js b/frontend/src/components/Inputs/InputHour.spec.js new file mode 100644 index 000000000..2c2eb8f33 --- /dev/null +++ b/frontend/src/components/Inputs/InputHour.spec.js @@ -0,0 +1,46 @@ +import { mount } from '@vue/test-utils' +import InputHour from './InputHour' + +const localVue = global.localVue + +describe('InputHour', () => { + let wrapper + + const mocks = { + $t: jest.fn((t) => t), + $i18n: { + locale: jest.fn(() => 'en'), + }, + $n: jest.fn((n) => String(n)), + $route: { + params: {}, + }, + } + + describe('mount in a InputHour', () => { + const propsData = { + rules: {}, + name: '', + label: '', + placeholder: '', + value: 500, + validMaxTime: 25, + } + + const Wrapper = () => { + return mount(InputHour, { + localVue, + mocks, + propsData, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders the component input-hour', () => { + expect(wrapper.find('div.input-hour').exists()).toBe(true) + }) + }) +}) diff --git a/frontend/src/components/Inputs/InputHour.vue b/frontend/src/components/Inputs/InputHour.vue index 98e79e233..d99fea4a3 100644 --- a/frontend/src/components/Inputs/InputHour.vue +++ b/frontend/src/components/Inputs/InputHour.vue @@ -1,5 +1,5 @@