Actually done

This commit is contained in:
Michaela Brydon 2024-08-15 15:28:38 -04:00
parent ba988473a1
commit c249e4b833
2 changed files with 49 additions and 36 deletions

View file

@ -25,7 +25,7 @@ jest.mock('@/helpers/cms-content-helper', () => ({
const mockMixin = { const mockMixin = {
methods: { methods: {
getCmsContent: jest.fn(),//.mockImplementation(() => wordingText), getCmsContent: jest.fn(),
setCmsContent: jest.fn() setCmsContent: jest.fn()
} }
}; };
@ -178,6 +178,9 @@ function getMountedComponent(mainInitialState = {}, initialData = {}, methodToRu
} }
describe('OrderConfirmation.vue', () => { describe('OrderConfirmation.vue', () => {
afterEach(() => {
jest.resetAllMocks();
})
describe('Page pre-requisites', () => { describe('Page pre-requisites', () => {
test('If submitted order saved to store, page pre-reqs return true', async () => { test('If submitted order saved to store, page pre-reqs return true', async () => {
// Arrange // Arrange
@ -282,7 +285,7 @@ describe('OrderConfirmation.vue', () => {
expect(wrapper.vm.$router.navigateToExternalUrl).toHaveBeenCalledWith(carrierReturnUrl); expect(wrapper.vm.$router.navigateToExternalUrl).toHaveBeenCalledWith(carrierReturnUrl);
}); });
}); });
describe.only('Computed properties', () => { describe('Computed properties', () => {
describe('customValueMap', () =>{ describe('customValueMap', () =>{
test.each([ test.each([
'inShopAppointment', 'inShopAppointment',
@ -352,6 +355,10 @@ describe('OrderConfirmation.vue', () => {
describe('confirmationEmailText', () => { describe('confirmationEmailText', () => {
const greaterId = ">"; const greaterId = ">";
const lessId = "<"; const lessId = "<";
const mobileWording = "Mobile wording";
const nonMobileWording = "Non mobile wording";
const mobileWidget = "MobileWordingWidget";
const dropOffAndInShopWidget = "DropOffAndInShopWordingWidget"
test.each([ test.each([
['test', 'test'], ['test', 'test'],
[`te${greaterId}st`, 'te>st'], [`te${greaterId}st`, 'te>st'],
@ -365,7 +372,7 @@ describe('OrderConfirmation.vue', () => {
const mockStoreActions = () => { const mockStoreActions = () => {
useMainStore().getSubmittedOrder = jest.fn().mockImplementation(() => sessionStorage); useMainStore().getSubmittedOrder = jest.fn().mockImplementation(() => sessionStorage);
}; };
getStringWithCustomValues.mockImplementation(() => rawCms); getStringWithCustomValues.mockReturnValue(rawCms);
const { wrapper } = getMountedComponent(initialStore, {}, mockStoreActions); const { wrapper } = getMountedComponent(initialStore, {}, mockStoreActions);
// Act // Act
@ -750,22 +757,25 @@ describe('OrderConfirmation.vue', () => {
const nonMobileWording = "Non mobile wording"; const nonMobileWording = "Non mobile wording";
const mobileWidget = "MobileWordingWidget"; const mobileWidget = "MobileWordingWidget";
const dropOffAndInShopWidget = "DropOffAndInShopWordingWidget" const dropOffAndInShopWidget = "DropOffAndInShopWordingWidget"
const mixin = { let mixin;
methods: { beforeEach(() => {
getCmsContent: jest.fn().mockImplementation((widget, _) => { processIfStatements.mockImplementation((content) => content);
if (widget == mobileWidget){ getStringWithCustomValues.mockImplementation((content, _) => content);
return mobileWording; mixin = {
} methods: {
if (widget == dropOffAndInShopWidget){ getCmsContent: jest.fn().mockImplementation((widget, _) => {
return nonMobileWording; if (widget == mobileWidget){
} return mobileWording;
return ""; }
}), if (widget == dropOffAndInShopWidget){
setCmsContent: jest.fn() return nonMobileWording;
} }
}; return "";
processIfStatements.mockImplementation((content) => content); }),
getStringWithCustomValues.mockImplementation((content, _) => content); setCmsContent: jest.fn()
}
};
});
test.each([ test.each([
[AppointmentTypeStrings.MOBILE, mobileWording], [AppointmentTypeStrings.MOBILE, mobileWording],
[AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP, mobileWording], [AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP, mobileWording],
@ -796,22 +806,25 @@ describe('OrderConfirmation.vue', () => {
const nonMobileWording = "Non mobile wording"; const nonMobileWording = "Non mobile wording";
const mobileWidget = "MobileWordingWidget"; const mobileWidget = "MobileWordingWidget";
const dropOffAndInShopWidget = "DropOffAndInShopWordingWidget" const dropOffAndInShopWidget = "DropOffAndInShopWordingWidget"
const mixin = { let mixin;
methods: { beforeEach(() => {
getCmsContent: jest.fn().mockImplementation((widget, _) => { processIfStatements.mockImplementation((content) => content);
if (widget == mobileWidget){ getStringWithCustomValues.mockImplementation((content, _) => content);
return mobileWording; mixin = {
} methods: {
if (widget == dropOffAndInShopWidget){ getCmsContent: jest.fn().mockImplementation((widget, _) => {
return nonMobileWording; if (widget == mobileWidget){
} return mobileWording;
return ""; }
}), if (widget == dropOffAndInShopWidget){
setCmsContent: jest.fn() return nonMobileWording;
} }
}; return "";
processIfStatements.mockImplementation((content) => content); }),
getStringWithCustomValues.mockImplementation((content, _) => content); setCmsContent: jest.fn()
}
};
});
test.each([ test.each([
[AppointmentTypeStrings.MOBILE, mobileWording], [AppointmentTypeStrings.MOBILE, mobileWording],
[AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP, mobileWording], [AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP, mobileWording],

View file

@ -257,7 +257,7 @@ export default {
providerFullAddress() { providerFullAddress() {
var { streetAddress, city, state, zipCode } = this.providerAddress; var { streetAddress, city, state, zipCode } = this.providerAddress;
return streetAddress return streetAddress
? `${toTitleCase(streetAddress)},<br/> ${toTitleCase(city)}, ${state} ${zipCode}` ? `${toTitleCase(streetAddress)},<br/> ${toTitleCase(city)}, ${state ?? ''} ${zipCode ?? ''}`
: ''; : '';
}, },
appointmentWordingText() { appointmentWordingText() {