Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dlohvinov committed Nov 1, 2023
1 parent 97d25bf commit 559818a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/app/components/__tests__/wt-omni-widget.spec.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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 protected]',
[AlternativeChanne.EMAIL]: '[email protected]',
};
const wrapper = shallowMount(WtOmniWidgetButtonsMenu, {
computed: {
Expand All @@ -56,7 +56,7 @@ describe('WtOmniWidgetButtonsMenu', () => {
},
},
});
expect(wrapper.vm.buttons).toEqual([{ type: AlternativeChannel.EMAIL, url: 'mailto:[email protected]' }]);
expect(wrapper.vm.buttons).toEqual([{ type: AlternativeChanne.EMAIL, url: 'mailto:[email protected]' }]);
});

it('correctly computes menu, processing urls: "mailto:" email case', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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() {
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ describe('WtOmniWidgetWindowHeader', () => {
view: {},
};
},
callSessionState() {
return null;
},
},
});
expect(wrapper.exists()).toBe(true);
Expand Down

0 comments on commit 559818a

Please sign in to comment.