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

View file

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