From 559818abf0d4fd265def55ebdebb423480783674 Mon Sep 17 00:00:00 2001 From: dlohvinov Date: Wed, 1 Nov 2023 22:17:39 +0200 Subject: [PATCH] fix: tests --- .../components/__tests__/wt-omni-widget.spec.js | 3 ++- .../wt-omni-widget-buttons-menu.spec.js | 16 ++++++++-------- .../__tests__/wt-omni-widget-window.spec.js | 6 ++++-- .../wt-omni-widget-window-header.spec.js | 3 +++ 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/app/components/__tests__/wt-omni-widget.spec.js b/src/app/components/__tests__/wt-omni-widget.spec.js index 08379fa..b90a38f 100644 --- a/src/app/components/__tests__/wt-omni-widget.spec.js +++ b/src/app/components/__tests__/wt-omni-widget.spec.js @@ -1,4 +1,5 @@ import { shallowMount } from '@vue/test-utils'; +import WidgetChannel from '../../enums/WidgetChannel.enum'; import WtOmniWidget from '../wt-omni-widget.vue'; import WtOmniWidgetWindow from '../wt-omni-widget-window/wt-omni-widget-window.vue'; @@ -32,7 +33,7 @@ describe('WtOmniWidget Component', () => { const wrapper = shallowMount(WtOmniWidget, { computed, }); - wrapper.findComponent(WtOmniWidgetButtonsMenu).vm.$emit('open', { channel: 'test' }); + wrapper.findComponent(WtOmniWidgetButtonsMenu).vm.$emit('open', { channel: WidgetChannel.CHAT }); await wrapper.vm.$nextTick(); expect(wrapper.findComponent(WtOmniWidgetButtonsMenu).exists()).toBe(false); expect(wrapper.findComponent(WtOmniWidgetWindow).isVisible()).toBe(true); diff --git a/src/app/components/wt-omni-widget-button/__tests__/wt-omni-widget-buttons-menu.spec.js b/src/app/components/wt-omni-widget-button/__tests__/wt-omni-widget-buttons-menu.spec.js index bb89bf1..5b98570 100644 --- a/src/app/components/wt-omni-widget-button/__tests__/wt-omni-widget-buttons-menu.spec.js +++ b/src/app/components/wt-omni-widget-button/__tests__/wt-omni-widget-buttons-menu.spec.js @@ -1,7 +1,7 @@ import { shallowMount } from '@vue/test-utils'; -import WtOmniWidgetButtonsMenu from '../wt-omni-widget-buttons-menu.vue'; -import AlternativeChannel from '../../../enums/AlternativeChannel.enum'; import WidgetChannel from '../../../enums/WidgetChannel.enum'; +import WtOmniWidgetButtonsMenu from '../wt-omni-widget-buttons-menu.vue'; +import AlternativeChanne from '../../../enums/AlternativeChannel.enum'; describe('WtOmniWidgetButtonsMenu', () => { it('renders a component', () => { @@ -19,7 +19,7 @@ describe('WtOmniWidgetButtonsMenu', () => { it('correctly computes menu, processing urls: no "https" case', () => { const alternativeChannels = { - [AlternativeChannel.VIBER]: 'viber://co', + [AlternativeChanne.VIBER]: 'viber://co', }; const wrapper = shallowMount(WtOmniWidgetButtonsMenu, { computed: { @@ -28,12 +28,12 @@ describe('WtOmniWidgetButtonsMenu', () => { }, }, }); - expect(wrapper.vm.buttons).toEqual([{ type: AlternativeChannel.VIBER, url: 'viber://co' }]); + expect(wrapper.vm.buttons).toEqual([{ type: AlternativeChanne.VIBER, url: 'viber://co' }]); }); it('correctly computes menu, processing urls: "https" case', () => { const alternativeChannels = { - [AlternativeChannel.WHATSAPP]: 'https://whatsapp.co', + [AlternativeChanne.WHATSAPP]: 'https://whatsapp.co', }; const wrapper = shallowMount(WtOmniWidgetButtonsMenu, { computed: { @@ -42,12 +42,12 @@ describe('WtOmniWidgetButtonsMenu', () => { }, }, }); - expect(wrapper.vm.buttons).toEqual([{type: AlternativeChannel.WHATSAPP, url: 'https://whatsapp.co' }]); + expect(wrapper.vm.buttons).toEqual([{type: AlternativeChanne.WHATSAPP, url: 'https://whatsapp.co' }]); }); it('correctly computes menu, processing urls: no "mailto:" email case', () => { const alternativeChannels = { - [AlternativeChannel.EMAIL]: 'email@example.com', + [AlternativeChanne.EMAIL]: 'email@example.com', }; const wrapper = shallowMount(WtOmniWidgetButtonsMenu, { computed: { @@ -56,7 +56,7 @@ describe('WtOmniWidgetButtonsMenu', () => { }, }, }); - expect(wrapper.vm.buttons).toEqual([{ type: AlternativeChannel.EMAIL, url: 'mailto:email@example.com' }]); + expect(wrapper.vm.buttons).toEqual([{ type: AlternativeChanne.EMAIL, url: 'mailto:email@example.com' }]); }); it('correctly computes menu, processing urls: "mailto:" email case', () => { diff --git a/src/app/components/wt-omni-widget-window/__tests__/wt-omni-widget-window.spec.js b/src/app/components/wt-omni-widget-window/__tests__/wt-omni-widget-window.spec.js index ff07cfa..ee2ac9e 100644 --- a/src/app/components/wt-omni-widget-window/__tests__/wt-omni-widget-window.spec.js +++ b/src/app/components/wt-omni-widget-window/__tests__/wt-omni-widget-window.spec.js @@ -1,11 +1,13 @@ import { shallowMount } from '@vue/test-utils'; +import WidgetChannel from '../../../enums/WidgetChannel.enum'; import WtOmniWidgetWindow from '../wt-omni-widget-window.vue'; describe('WtOmniWidgetWindow', () => { + it('renders a component', () => { const wrapper = shallowMount(WtOmniWidgetWindow, { propsData: { - channel: 'chat', + channel: WidgetChannel.CHAT, }, computed: { config() { @@ -22,7 +24,7 @@ describe('WtOmniWidgetWindow', () => { it('renders a component in preview mode', () => { const wrapper = shallowMount(WtOmniWidgetWindow, { propsData: { - channel: 'chat', + channel: WidgetChannel.CHAT, }, computed: { config() { diff --git a/src/app/components/wt-omni-widget-window/wt-omni-widget-window-header/__tests__/wt-omni-widget-window-header.spec.js b/src/app/components/wt-omni-widget-window/wt-omni-widget-window-header/__tests__/wt-omni-widget-window-header.spec.js index b3378fe..0fd82f5 100644 --- a/src/app/components/wt-omni-widget-window/wt-omni-widget-window-header/__tests__/wt-omni-widget-window-header.spec.js +++ b/src/app/components/wt-omni-widget-window/wt-omni-widget-window-header/__tests__/wt-omni-widget-window-header.spec.js @@ -10,6 +10,9 @@ describe('WtOmniWidgetWindowHeader', () => { view: {}, }; }, + callSessionState() { + return null; + }, }, }); expect(wrapper.exists()).toBe(true);