Commit 68cef200 authored by Donald Cook's avatar Donald Cook

Added more test coverage

parent aaf84be4
...@@ -2,6 +2,7 @@ import { mount } from '@vue/test-utils'; ...@@ -2,6 +2,7 @@ import { mount } from '@vue/test-utils';
import AxiosMockAdapter from 'axios-mock-adapter'; import AxiosMockAdapter from 'axios-mock-adapter';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import ServiceDeskRoot from '~/projects/settings_service_desk/components/service_desk_root.vue'; import ServiceDeskRoot from '~/projects/settings_service_desk/components/service_desk_root.vue';
import ServiceDeskSetting from '~/projects/settings_service_desk/components/service_desk_setting.vue';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import httpStatusCodes from '~/lib/utils/http_status'; import httpStatusCodes from '~/lib/utils/http_status';
...@@ -162,4 +163,18 @@ describe('ServiceDeskRoot', () => { ...@@ -162,4 +163,18 @@ describe('ServiceDeskRoot', () => {
expect(wrapper.html()).toContain('An error occured while making the changes:'); expect(wrapper.html()).toContain('An error occured while making the changes:');
}); });
}); });
it('passes customEmail through updatedCustomEmail correctly', () => {
const customEmail = 'foo';
wrapper = mount(ServiceDeskRoot, {
propsData: {
initialIsEnabled: true,
endpoint,
customEmail,
},
});
expect(wrapper.find(ServiceDeskSetting).props('customEmail')).toEqual(customEmail);
});
}); });
...@@ -85,6 +85,45 @@ describe('ServiceDeskSetting', () => { ...@@ -85,6 +85,45 @@ describe('ServiceDeskSetting', () => {
}); });
}); });
describe('with customEmail', () => {
describe('customEmail is different than incomingEmail', () => {
const incomingEmail = 'foo@bar.com';
const customEmail = 'custom@bar.com';
beforeEach(() => {
wrapper = mount(ServiceDeskSetting, {
propsData: {
isEnabled: true,
incomingEmail,
customEmail,
},
});
});
it('should see custom email', () => {
expect(wrapper.find('.incoming-email').element.value).toEqual(customEmail);
});
});
describe('customEmail is the same as incomingEmail', () => {
const customEmail = 'foo@bar.com';
beforeEach(() => {
wrapper = mount(ServiceDeskSetting, {
propsData: {
isEnabled: true,
incomingEmail: customEmail,
customEmail,
},
});
});
it('should see custom email', () => {
expect(wrapper.find('.incoming-email').element.value).toEqual(customEmail);
});
});
});
describe('templates dropdown', () => { describe('templates dropdown', () => {
it('renders a dropdown to choose a template', () => { it('renders a dropdown to choose a template', () => {
wrapper = shallowMount(ServiceDeskSetting, { wrapper = shallowMount(ServiceDeskSetting, {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment