CSR-731 | Unit tests

Still need to test pricing stuff on service-package-question as well as test the new cms content helper stuff
This commit is contained in:
Scott Kiener 2022-11-14 16:11:09 -05:00
parent 33692d3046
commit 020bbf6971
5 changed files with 1111 additions and 457 deletions

View file

@ -17,10 +17,8 @@ module.exports = {
"!src/layouts/capability-questions/**/*.vue", "!src/layouts/capability-questions/**/*.vue",
"!src/layouts/part-questions/**/*.vue", "!src/layouts/part-questions/**/*.vue",
"!src/layouts/reveal/**/*.vue", "!src/layouts/reveal/**/*.vue",
"!src/layouts/quote/**/*.vue",
"!src/ux-components/text-link/**/*.vue", "!src/ux-components/text-link/**/*.vue",
"!src/common-components/question-chain/**/*.vue", "!src/common-components/question-chain/**/*.vue",
"!src/layouts/quote/**/*.vue", // Temporary
"!src/layouts/vin-lookup/**/*.vue", //Temporary for Quote page testing "!src/layouts/vin-lookup/**/*.vue", //Temporary for Quote page testing
"!src/common-components/funnel-header/menu-modal/**/*.vue", "!src/common-components/funnel-header/menu-modal/**/*.vue",
// END // END

View file

@ -115,25 +115,34 @@ describe("buttonQuestion.vue", () => {
"2020", "2020",
]); ]);
}); });
test("should accept an imported component for buttonTypeObject and successfully add it to components", async ()=> { test("should accept an imported component for buttonTypeObject and successfully add it to components", async () => {
// Arrange // Arrange
const mockComponent = { const mockComponent = {
name: 'mockComponent', name: "mockComponent",
methods: { methods: {
mockComponentMethod() {return 'mockComponentMethod return value'} mockComponentMethod() {
} return "mockComponentMethod return value";
},
},
}; };
const wrapper = await shallowMount( const wrapper = await shallowMount(
buttonQuestion, buttonQuestion,
setupMocks({propsData: {'buttonTypeString': 'mockComponent', 'buttonTypeObject': mockComponent}}) setupMocks({
); propsData: {
buttonTypeString: "mockComponent",
buttonTypeObject: mockComponent,
},
})
);
// Act // Act
const componentList = wrapper.vm.$options.components; const componentList = wrapper.vm.$options.components;
const componentExists = !!componentList.mockComponent; const componentExists = !!componentList.mockComponent;
const componentNameMatches = componentList.mockComponent.name === mockComponent.name; const componentNameMatches = componentList.mockComponent.name === mockComponent.name;
const componentMethodMatches = componentList.mockComponent.methods.mockComponentMethod() === mockComponent.methods.mockComponentMethod(); const componentMethodMatches =
componentList.mockComponent.methods.mockComponentMethod() ===
mockComponent.methods.mockComponentMethod();
// Assert // Assert
expect(componentExists && componentNameMatches && componentMethodMatches).toBe(true); expect(componentExists && componentNameMatches && componentMethodMatches).toBe(true);

View file

@ -1,279 +1,580 @@
export const mockProcessedCmsContent = { export const mockProcessedCmsContent = {
"05_01_CSR_Quote_Standard_Repair" : { "05_01_CSR_Quote_Standard_Repair": {
EconomyServicePackage: { EconomyServicePackage: {
HeaderText: 'Economy service', HeaderText: "Economy service",
SubheaderText: '', SubheaderText: "",
BodyText: '<ul><li>Expert windshield repair</li><li>Exclusive resin sealant</li><li>Nationwide lifetime guarantee</li></ul>', BodyText:
Image: '', "<ul><li>Expert windshield repair</li><li>Exclusive resin sealant</li><li>Nationwide lifetime guarantee</li></ul>",
FooterText: '{if:custom:frontWipersApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{else}{if:custom:rearWiperApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{end}{end}' Image: "",
FooterText:
"{if:custom:frontWipersApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{else}{if:custom:rearWiperApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{end}{end}",
},
StandardServicePackage: {
HeaderText: "Standard service",
SubheaderText: "MOST POPULAR",
BodyText:
"<ul><li>Expert windshield repair</li><li>Exclusive resin sealant</li><li>Nationwide lifetime guarantee</li><li>{if:custom:frontWipersApplicableForTierTwo}{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li></ul>",
Image: "",
FooterText: "",
},
PremiumServicePackage: {
HeaderText: "Premium service",
SubheaderText: "",
BodyText:
"<ul><li>Expert windshield repair</li><li>Exclusive resin sealant</li><li>Nationwide lifetime guarantee</li><li>{if:custom:frontWipersApplicableForTierThree}{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li><li>{if:custom:rainDefenseApplicableForTierThree}{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment{end}</li></ul>",
Image: "",
FooterText: "",
},
}, },
StandardServicePackage: { "05_01_CSR_Quote_Recal": {
HeaderText: 'Standard service', EconomyServicePackage: {
SubheaderText: 'MOST POPULAR', HeaderText: "Economy service",
BodyText: '<ul><li>Expert windshield repair</li><li>Exclusive resin sealant</li><li>Nationwide lifetime guarantee</li><li>{if:custom:frontWipersApplicableForTierTwo}{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li></ul>', SubheaderText: "",
Image: '', BodyText:
FooterText: '' "<ul><li>New replacement windshield</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li></ul>",
Image: "",
FooterText:
"{if:custom:frontWipersApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{else}{if:custom:rearWiperApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{end}{end}",
},
StandardServicePackage: {
HeaderText: "Standard service",
SubheaderText: "MOST POPULAR",
BodyText:
"<ul><li>New replacement windshield</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierTwo}{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li></ul>",
Image: "",
FooterText: "",
},
PremiumServicePackage: {
HeaderText: "Premium service",
SubheaderText: "",
BodyText:
"<ul><li>New replacement windshield</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierThree}{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li><li>{if:custom:rainDefenseApplicableForTierThree}{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment{end}</li></ul>",
Image: "",
FooterText: "",
},
}, },
PremiumServicePackage: { "05_01_CSR_Quote_RearGlass": {
HeaderText: 'Premium service', EconomyServicePackage: {
SubheaderText: '', HeaderText: "Economy service",
BodyText: '<ul><li>Expert windshield repair</li><li>Exclusive resin sealant</li><li>Nationwide lifetime guarantee</li><li>{if:custom:frontWipersApplicableForTierThree}{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li><li>{if:custom:rainDefenseApplicableForTierThree}{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment{end}</li></ul>', SubheaderText: "",
Image: '', BodyText:
FooterText: '' "<ul><li>New replacement glass</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li></ul>",
} Image: "",
}, FooterText:
"05_01_CSR_Quote_Recal": { "{if:custom:frontWipersApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{else}{if:custom:rearWiperApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{end}{end}",
EconomyServicePackage: { },
HeaderText: 'Economy service', StandardServicePackage: {
SubheaderText: '', HeaderText: "Standard service",
BodyText: '<ul><li>New replacement windshield</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li></ul>', SubheaderText: "MOST POPULAR",
Image: '', BodyText:
FooterText: '{if:custom:frontWipersApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{else}{if:custom:rearWiperApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{end}{end}' "<ul><li>New replacement glass</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierTwo}{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li></ul>",
Image: "",
FooterText: "",
},
PremiumServicePackage: {
HeaderText: "Premium service",
SubheaderText: "",
BodyText:
"<ul><li>New replacement glass</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierThree}{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li><li>{if:custom:rainDefenseApplicableForTierThree}{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment{end}</li></ul>",
Image: "",
FooterText: "",
},
}, },
StandardServicePackage: { "05_01_CSR_Quote_RearGlass+NonWindshield": {
HeaderText: 'Standard service', EconomyServicePackage: {
SubheaderText: 'MOST POPULAR', HeaderText: "Economy service",
BodyText: '<ul><li>New replacement windshield</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierTwo}{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li></ul>', SubheaderText: "",
Image: '', BodyText:
FooterText: '' "<ul><li>New replacement glass</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li></ul>",
Image: "",
FooterText:
"{if:custom:frontWipersApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{else}{if:custom:rearWiperApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{end}{end}",
},
StandardServicePackage: {
HeaderText: "Standard service",
SubheaderText: "MOST POPULAR",
BodyText:
"<ul><li>New replacement glass</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierTwo}{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li></ul>",
Image: "",
FooterText: "",
},
PremiumServicePackage: {
HeaderText: "Premium service",
SubheaderText: "",
BodyText:
"<ul><li>New replacement glass</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierThree}{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li><li>{if:custom:rainDefenseApplicableForTierThree}{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment{end}</li></ul>",
Image: "",
FooterText: "",
},
}, },
PremiumServicePackage: { "05_01_CSR_Quote_RearGlass+Windshield": {
HeaderText: 'Premium service', EconomyServicePackage: {
SubheaderText: '', HeaderText: "Economy service",
BodyText: '<ul><li>New replacement windshield</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierThree}{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li><li>{if:custom:rainDefenseApplicableForTierThree}{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment{end}</li></ul>', SubheaderText: "",
Image: '', BodyText:
FooterText: '' "<ul><li>New replacement glass</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li></ul>",
} Image: "",
}, FooterText:
"05_01_CSR_Quote_RearGlass": { "{if:custom:frontWipersApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{else}{if:custom:rearWiperApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{end}{end}",
EconomyServicePackage: { },
HeaderText: 'Economy service', StandardServicePackage: {
SubheaderText: '', HeaderText: "Standard service",
BodyText: '<ul><li>New replacement glass</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li></ul>', SubheaderText: "MOST POPULAR",
Image: '', BodyText:
FooterText: '{if:custom:frontWipersApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{else}{if:custom:rearWiperApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{end}{end}' "<ul><li>New replacement glass</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierTwo}{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li></ul>",
Image: "",
FooterText: "",
},
PremiumServicePackage: {
HeaderText: "Premium service",
SubheaderText: "",
BodyText:
"<ul><li>New replacement glass</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierThree}{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li><li>{if:custom:rainDefenseApplicableForTierThree}{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment{end}</li></ul>",
Image: "",
FooterText: "",
},
}, },
StandardServicePackage: { "05_01_CSR_Quote_RearGlassNoFrontFit": {
HeaderText: 'Standard service', EconomyServicePackage: {
SubheaderText: 'MOST POPULAR', HeaderText: "Economy service",
BodyText: '<ul><li>New replacement glass</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierTwo}{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li></ul>', SubheaderText: "",
Image: '', BodyText:
FooterText: '' "<ul><li>New replacement glass</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li></ul>",
Image: "",
FooterText:
"{if:custom:frontWipersApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{else}{if:custom:rearWiperApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{end}{end}",
},
StandardServicePackage: {
HeaderText: "Standard service",
SubheaderText: "MOST POPULAR",
BodyText:
"<ul><li>New replacement glass</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierTwo}{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li></ul>",
Image: "",
FooterText: "",
},
PremiumServicePackage: {
HeaderText: "Premium service",
SubheaderText: "",
BodyText:
"<ul><li>New replacement glass</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierThree}{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li><li>{if:custom:rainDefenseApplicableForTierThree}{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment{end}</li></ul>",
Image: "",
FooterText: "",
},
},
"05_01_CSR_Quote_Windshield+SideGlass": {
EconomyServicePackage: {
HeaderText: "Economy service",
SubheaderText: "",
BodyText:
"<ul><li>New replacement glass</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li></ul>",
Image: "",
FooterText:
"{if:custom:frontWipersApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{else}{if:custom:rearWiperApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{end}{end}",
},
StandardServicePackage: {
HeaderText: "Standard service",
SubheaderText: "MOST POPULAR",
BodyText:
"<ul><li>New replacement glass</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierTwo}{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li></ul>",
Image: "",
FooterText: "",
},
PremiumServicePackage: {
HeaderText: "Premium service",
SubheaderText: "",
BodyText:
"<ul><li>New replacement glass</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierThree}{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li><li>{if:custom:rainDefenseApplicableForTierThree}{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment{end}</li></ul>",
Image: "",
FooterText: "",
},
},
"05_01_CSR_Quote_SideGlass": {
EconomyServicePackage: {
HeaderText: "Economy service",
SubheaderText: "",
BodyText:
"<ul><li>New replacement glass</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li></ul>",
Image: "",
FooterText:
"{if:custom:frontWipersApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{else}{if:custom:rearWiperApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{end}{end}",
},
StandardServicePackage: {
HeaderText: "Standard service",
SubheaderText: "MOST POPULAR",
BodyText:
"<ul><li>New replacement glass</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierTwo}{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li></ul>",
Image: "",
FooterText: "",
},
PremiumServicePackage: {
HeaderText: "Premium service",
SubheaderText: "",
BodyText:
"<ul><li>New replacement glass</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierThree}{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li><li>{if:custom:rainDefenseApplicableForTierThree}{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment{end}</li></ul>",
Image: "",
FooterText: "",
},
},
"05_01_CSR_Quote_NoWiperFit": {
EconomyServicePackage: {
HeaderText: "Economy service",
SubheaderText: "",
BodyText:
"<ul><li>New replacement windshield</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li></ul>",
Image: "",
FooterText:
"{if:custom:frontWipersApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{else}{if:custom:rearWiperApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{end}{end}",
},
StandardServicePackage: {
HeaderText: "Standard service",
SubheaderText: "MOST POPULAR",
BodyText:
"<ul><li>New replacement windshield</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierTwo}{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li></ul>",
Image: "",
FooterText: "",
},
PremiumServicePackage: {
HeaderText: "Premium service",
SubheaderText: "",
BodyText:
"<ul><li>New replacement windshield</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierThree}{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li><li>{if:custom:rainDefenseApplicableForTierThree}{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment{end}</li></ul>",
Image: "",
FooterText: "",
},
},
badCustomValue: {
EconomyServicePackage: {
HeaderText: "Economy service",
SubheaderText: "",
BodyText:
"<ul><li>New replacement windshield</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li></ul>",
Image: "",
FooterText:
"{if:custom:frontWipersApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{else}{if:custom:rearWiperApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{end}{end}",
},
StandardServicePackage: {
HeaderText: "Standard service",
SubheaderText: "MOST POPULAR",
BodyText:
"<ul><li>New replacement windshield</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierTwo}{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li></ul>",
Image: "",
FooterText: "",
},
PremiumServicePackage: {
HeaderText: "Premium service",
SubheaderText: "",
BodyText:
"<ul><li>{if:custom:badCustomValue}DO NOT SHOW{end}New replacement windshield</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierThree}{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li><li>{if:custom:rainDefenseApplicableForTierThree}{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment{end}</li></ul>",
Image: "",
FooterText: "",
},
}, },
PremiumServicePackage: {
HeaderText: 'Premium service',
SubheaderText: '',
BodyText: '<ul><li>New replacement glass</li><li>Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}</li><li>Nationwide lifetime warranty</li><li>{if:custom:frontWipersApplicableForTierThree}{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li><li>{if:custom:rainDefenseApplicableForTierThree}{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment{end}</li></ul>',
Image: '',
FooterText: ''
}
}
}; };
export const inputQuestionWidgetAnswers = { export const inputQuestionWidgetAnswers = {
CashServicePackageQuestionWidget: { CashServicePackageQuestionWidget: {
"Answers": [ Answers: [
{ {
"Name": "TierOne", Name: "TierOne",
"SubWidgetName": "EconomyServicePackage" SubWidgetName: "EconomyServicePackage",
}, },
{ {
"Name": "TierTwo", Name: "TierTwo",
"SubWidgetName": "StandardServicePackage" SubWidgetName: "StandardServicePackage",
}, },
{ {
"Name": "TierThree", Name: "TierThree",
"SubWidgetName": "PremiumServicePackage" SubWidgetName: "PremiumServicePackage",
} },
] ],
}, },
InsuranceServicePackageQuestionWidget: { InsuranceServicePackageQuestionWidget: {
"Answers": [ Answers: [
{ {
"Name": "TierOne", Name: "TierOne",
"SubWidgetName": "EconomyServicePackage" SubWidgetName: "EconomyServicePackage",
}, },
{ {
"Name": "TierTwo", Name: "TierTwo",
"SubWidgetName": "StandardServicePackage" SubWidgetName: "StandardServicePackage",
}, },
{ {
"Name": "TierThree", Name: "TierThree",
"SubWidgetName": "PremiumServicePackage" SubWidgetName: "PremiumServicePackage",
} },
] ],
} },
}; };
export const mockCmsContent = {
"Result": [
{
"Name": "CashServicePackageQuestionWidget",
"Model": {
"QuestionText": "",
"Answers": [
{
"Name": "TierOne",
"Text": "",
"SubText": "",
"AnswerImageUrl": "",
"SubWidgetName": "EconomyServicePackage"
},
{
"Name": "TierTwo",
"Text": "",
"SubText": "",
"AnswerImageUrl": "",
"SubWidgetName": "StandardServicePackage"
},
{
"Name": "TierThree",
"Text": "",
"SubText": "",
"AnswerImageUrl": "",
"SubWidgetName": "PremiumServicePackage"
}
]
}
},
{
"Name": "InsuranceServicePackageQuestionWidget",
"Model": {
"QuestionText": "",
"Answers": [
{
"Name": "TierOne",
"Text": "",
"SubText": "",
"AnswerImageUrl": "",
"SubWidgetName": "EconomyServicePackage"
},
{
"Name": "TierTwo",
"Text": "",
"SubText": "",
"AnswerImageUrl": "",
"SubWidgetName": "StandardServicePackage"
},
{
"Name": "TierThree",
"Text": "",
"SubText": "",
"AnswerImageUrl": "",
"SubWidgetName": "PremiumServicePackage"
}
]
}
},
{
"Name": "EconomyServicePackage",
"Model": {
"HeaderText": "Economy service",
"SubheaderText": "",
"BodyText": "<ul><li>{if:globalState:order.damage.isRepair}Expert windshield repair{else}New replacement {if:globalState:getters.hasAnyNonWindshieldGlassParts}glass{else}windshield{end}{end}</li><li>{if:globalState:order.damage.isRepair}Exclusive resin sealant{else}Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}{end}</li><li>Nationwide lifetime {if:globalState:order.damage.isRepair}guarantee{else}warranty{end}</li></ul>",
"Image": "",
"FooterText": "{if:custom:frontWipersApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{else}{if:custom:rearWiperApplicableForTierTwo}New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.{end}{end}"
}
},
{
"Name": "StandardServicePackage",
"Model": {
"HeaderText": "Standard service",
"SubheaderText": "MOST POPULAR",
"BodyText": "<ul><li>{if:globalState:order.damage.isRepair}Expert windshield repair{else}New replacement {if:globalState:getters.hasAnyNonWindshieldGlassParts}glass{else}windshield{end}{end}</li><li>{if:globalState:order.damage.isRepair}Exclusive resin sealant{else}Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}{end}</li><li>Nationwide lifetime {if:globalState:order.damage.isRepair}guarantee{else}warranty{end}</li><li>{if:custom:frontWipersApplicableForTierTwo}{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierTwo}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li></ul>",
"Image": "",
"FooterText": ""
}
},
{
"Name": "PremiumServicePackage",
"Model": {
"HeaderText": "Premium service",
"SubheaderText": "",
"BodyText": "<ul><li>{if:globalState:order.damage.isRepair}Expert windshield repair{else}New replacement {if:globalState:getters.hasAnyNonWindshieldGlassParts}glass{else}windshield{end}{end}</li><li>{if:globalState:order.damage.isRepair}Exclusive resin sealant{else}Expert installation{if:custom:isRecalibrationOnOrder} and {textLink:EstimateRecalModal,recalibration}{end}{end}</li><li>Nationwide lifetime {if:globalState:order.damage.isRepair}guarantee{else}warranty{end}</li><li>{if:custom:frontWipersApplicableForTierThree}{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateFrontWiperModal,front wiper blades}{else}New {textLink:EstimateFrontWiperModal,wiper blades}{end}{end}</li><li>{if:custom:rearWiperApplicableForTierThree}New {textLink:EstimateRearWiperModal,rear wiper blade}{end}</li><li>{if:custom:rainDefenseApplicableForTierThree}{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment{end}</li></ul>",
"Image": "",
"FooterText": ""
}
}
]};
export const expectedModifiedAnswers = { export const expectedModifiedAnswers = {
"05_01_CSR_Quote_Standard_Repair" : { "05_01_CSR_Quote_Standard_Repair": {
tierOne: { tierOne: {
value: 'TierOne', value: "TierOne",
buttonLabel: 'Economy service', buttonLabel: "Economy service",
buttonLabelSubCopy: '', buttonLabelSubCopy: "",
buttonBodyCopy: '<ul><li>Expert windshield repair</li><li>Exclusive resin sealant</li><li>Nationwide lifetime guarantee</li></ul>', buttonBodyCopy:
buttonAuxillaryCopy: '$500.22', "<ul><li>Expert windshield repair</li><li>Exclusive resin sealant</li><li>Nationwide lifetime guarantee</li></ul>",
buttonFooterCopy: 'New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.' buttonAuxillaryCopy: "$500.22",
}, buttonFooterCopy:
"New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.",
},
tierTwo: { tierTwo: {
value: 'TierTwo', value: "TierTwo",
buttonLabel: 'Standard service', buttonLabel: "Standard service",
buttonLabelSubCopy: 'MOST POPULAR', buttonLabelSubCopy: "MOST POPULAR",
buttonBodyCopy: '<ul><li>Expert windshield repair</li><li>Exclusive resin sealant</li><li>Nationwide lifetime guarantee</li><li>New {textLink:EstimateFrontWiperModal,wiper blades}</li><li></li></ul>', buttonBodyCopy:
buttonAuxillaryCopy: '$585.90', "<ul><li>Expert windshield repair</li><li>Exclusive resin sealant</li><li>Nationwide lifetime guarantee</li><li>New {textLink:EstimateFrontWiperModal,wiper blades}</li><li></li></ul>",
buttonFooterCopy: '' buttonAuxillaryCopy: "$585.90",
}, buttonFooterCopy: "",
},
tierThree: { tierThree: {
value: 'TierThree', value: "TierThree",
buttonLabel: 'Premium service', buttonLabel: "Premium service",
buttonLabelSubCopy: '', buttonLabelSubCopy: "",
buttonBodyCopy: '<ul><li>Expert windshield repair</li><li>Exclusive resin sealant</li><li>Nationwide lifetime guarantee</li><li>New {textLink:EstimateFrontWiperModal,wiper blades}</li><li></li><li>{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment</li></ul>', buttonBodyCopy:
buttonAuxillaryCopy: '$621.40', "<ul><li>Expert windshield repair</li><li>Exclusive resin sealant</li><li>Nationwide lifetime guarantee</li><li>New {textLink:EstimateFrontWiperModal,wiper blades}</li><li></li><li>{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment</li></ul>",
buttonFooterCopy: '' buttonAuxillaryCopy: "$621.40",
} buttonFooterCopy: "",
},
}, },
"05_01_CSR_Quote_Recal": { "05_01_CSR_Quote_Recal": {
tierOne: { tierOne: {
value: 'TierOne', value: "TierOne",
buttonLabel: 'Economy service', buttonLabel: "Economy service",
buttonLabelSubCopy: '', buttonLabelSubCopy: "",
buttonBodyCopy: '<ul><li>New replacement windshield</li><li>Expert installation and {textLink:EstimateRecalModal,recalibration}</li><li>Nationwide lifetime warranty</li></ul>', buttonBodyCopy:
buttonAuxillaryCopy: '$500.22', "<ul><li>New replacement windshield</li><li>Expert installation and {textLink:EstimateRecalModal,recalibration}</li><li>Nationwide lifetime warranty</li></ul>",
buttonFooterCopy: 'New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.' buttonAuxillaryCopy: "$500.22",
}, buttonFooterCopy:
tierTwo: { "New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.",
value: 'TierTwo', },
buttonLabel: 'Standard service', tierTwo: {
buttonLabelSubCopy: 'MOST POPULAR', value: "TierTwo",
buttonBodyCopy: '<ul><li>New replacement windshield</li><li>Expert installation and {textLink:EstimateRecalModal,recalibration}</li><li>Nationwide lifetime warranty</li><li>New {textLink:EstimateFrontWiperModal,wiper blades}</li><li></li></ul>', buttonLabel: "Standard service",
buttonAuxillaryCopy: '$585.90', buttonLabelSubCopy: "MOST POPULAR",
buttonFooterCopy: '' buttonBodyCopy:
}, "<ul><li>New replacement windshield</li><li>Expert installation and {textLink:EstimateRecalModal,recalibration}</li><li>Nationwide lifetime warranty</li><li>New {textLink:EstimateFrontWiperModal,wiper blades}</li><li></li></ul>",
tierThree: { buttonAuxillaryCopy: "$585.90",
value: 'TierThree', buttonFooterCopy: "",
buttonLabel: 'Premium service', },
buttonLabelSubCopy: '', tierThree: {
buttonBodyCopy: '<ul><li>New replacement windshield</li><li>Expert installation and {textLink:EstimateRecalModal,recalibration}</li><li>Nationwide lifetime warranty</li><li>New {textLink:EstimateFrontWiperModal,wiper blades}</li><li></li><li>{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment</li></ul>', value: "TierThree",
buttonAuxillaryCopy: '$621.40', buttonLabel: "Premium service",
buttonFooterCopy: '' buttonLabelSubCopy: "",
} buttonBodyCopy:
"<ul><li>New replacement windshield</li><li>Expert installation and {textLink:EstimateRecalModal,recalibration}</li><li>Nationwide lifetime warranty</li><li>New {textLink:EstimateFrontWiperModal,wiper blades}</li><li></li><li>{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment</li></ul>",
buttonAuxillaryCopy: "$621.40",
buttonFooterCopy: "",
},
}, },
"05_01_CSR_Quote_RearGlass": { "05_01_CSR_Quote_RearGlass": {
tierOne: { tierOne: {
value: 'TierOne', value: "TierOne",
buttonLabel: 'Economy service', buttonLabel: "Economy service",
buttonLabelSubCopy: '', buttonLabelSubCopy: "",
buttonBodyCopy: '<ul><li>New replacement glass</li><li>Expert installation</li><li>Nationwide lifetime warranty</li></ul>', buttonBodyCopy:
buttonAuxillaryCopy: '$350.22', "<ul><li>New replacement glass</li><li>Expert installation</li><li>Nationwide lifetime warranty</li></ul>",
buttonFooterCopy: 'New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.' buttonAuxillaryCopy: "$350.22",
}, buttonFooterCopy:
tierTwo: { "New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.",
value: 'TierTwo', },
buttonLabel: 'Standard service', tierTwo: {
buttonLabelSubCopy: 'MOST POPULAR', value: "TierTwo",
buttonBodyCopy: '<ul><li>New replacement glass</li><li>Expert installation</li><li>Nationwide lifetime warranty</li><li></li><li>New {textLink:EstimateRearWiperModal,rear wiper blade}</li></ul>', buttonLabel: "Standard service",
buttonAuxillaryCopy: '$374.70', buttonLabelSubCopy: "MOST POPULAR",
buttonFooterCopy: '' buttonBodyCopy:
}, "<ul><li>New replacement glass</li><li>Expert installation</li><li>Nationwide lifetime warranty</li><li></li><li>New {textLink:EstimateRearWiperModal,rear wiper blade}</li></ul>",
tierThree: { buttonAuxillaryCopy: "$374.70",
value: 'TierThree', buttonFooterCopy: "",
buttonLabel: 'Premium service', },
buttonLabelSubCopy: '', tierThree: {
buttonBodyCopy: '<ul><li>New replacement glass</li><li>Expert installation</li><li>Nationwide lifetime warranty</li><li>New {textLink:EstimateFrontWiperModal,front wiper blades}</li><li>New {textLink:EstimateRearWiperModal,rear wiper blade}</li><li></li></ul>', value: "TierThree",
buttonAuxillaryCopy: '$460.38', buttonLabel: "Premium service",
buttonFooterCopy: '' buttonLabelSubCopy: "",
} buttonBodyCopy:
"<ul><li>New replacement glass</li><li>Expert installation</li><li>Nationwide lifetime warranty</li><li>New {textLink:EstimateFrontWiperModal,front wiper blades}</li><li>New {textLink:EstimateRearWiperModal,rear wiper blade}</li><li></li></ul>",
buttonAuxillaryCopy: "$460.38",
buttonFooterCopy: "",
},
}, },
} "05_01_CSR_Quote_RearGlass+NonWindshield": {
tierOne: {
value: "TierOne",
buttonLabel: "Economy service",
buttonLabelSubCopy: "",
buttonBodyCopy:
"<ul><li>New replacement glass</li><li>Expert installation</li><li>Nationwide lifetime warranty</li></ul>",
buttonAuxillaryCopy: "$350.22",
buttonFooterCopy:
"New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.",
},
tierTwo: {
value: "TierTwo",
buttonLabel: "Standard service",
buttonLabelSubCopy: "MOST POPULAR",
buttonBodyCopy:
"<ul><li>New replacement glass</li><li>Expert installation</li><li>Nationwide lifetime warranty</li><li></li><li>New {textLink:EstimateRearWiperModal,rear wiper blade}</li></ul>",
buttonAuxillaryCopy: "$374.70",
buttonFooterCopy: "",
},
tierThree: {
value: "TierThree",
buttonLabel: "Premium service",
buttonLabelSubCopy: "",
buttonBodyCopy:
"<ul><li>New replacement glass</li><li>Expert installation</li><li>Nationwide lifetime warranty</li><li>New {textLink:EstimateFrontWiperModal,front wiper blades}</li><li>New {textLink:EstimateRearWiperModal,rear wiper blade}</li><li></li></ul>",
buttonAuxillaryCopy: "$460.38",
buttonFooterCopy: "",
},
},
"05_01_CSR_Quote_RearGlass+Windshield": {
tierOne: {
value: "TierOne",
buttonLabel: "Economy service",
buttonLabelSubCopy: "",
buttonBodyCopy:
"<ul><li>New replacement glass</li><li>Expert installation</li><li>Nationwide lifetime warranty</li></ul>",
buttonAuxillaryCopy: "$350.22",
buttonFooterCopy:
"New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.",
},
tierTwo: {
value: "TierTwo",
buttonLabel: "Standard service",
buttonLabelSubCopy: "MOST POPULAR",
buttonBodyCopy:
"<ul><li>New replacement glass</li><li>Expert installation</li><li>Nationwide lifetime warranty</li><li>New {textLink:EstimateFrontWiperModal,front wiper blades}</li><li>New {textLink:EstimateRearWiperModal,rear wiper blade}</li></ul>",
buttonAuxillaryCopy: "$460.38",
buttonFooterCopy: "",
},
tierThree: {
value: "TierThree",
buttonLabel: "Premium service",
buttonLabelSubCopy: "",
buttonBodyCopy:
"<ul><li>New replacement glass</li><li>Expert installation</li><li>Nationwide lifetime warranty</li><li>New {textLink:EstimateFrontWiperModal,front wiper blades}</li><li>New {textLink:EstimateRearWiperModal,rear wiper blade}</li><li>{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment</li></ul>",
buttonAuxillaryCopy: "$495.88",
buttonFooterCopy: "",
},
},
"05_01_CSR_Quote_RearGlassNoFrontFit": {
tierOne: {
value: "TierOne",
buttonLabel: "Economy service",
buttonLabelSubCopy: "",
buttonBodyCopy:
"<ul><li>New replacement glass</li><li>Expert installation</li><li>Nationwide lifetime warranty</li></ul>",
buttonAuxillaryCopy: "$350.22",
buttonFooterCopy:
"New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.",
},
tierTwo: {
value: "TierTwo",
buttonLabel: "Standard service",
buttonLabelSubCopy: "MOST POPULAR",
buttonBodyCopy:
"<ul><li>New replacement glass</li><li>Expert installation</li><li>Nationwide lifetime warranty</li><li></li><li>New {textLink:EstimateRearWiperModal,rear wiper blade}</li></ul>",
buttonAuxillaryCopy: "$374.70",
buttonFooterCopy: "",
},
tierThree: {
value: "TierThree",
buttonLabel: "Premium service",
buttonLabelSubCopy: "",
buttonBodyCopy:
"<ul><li>New replacement glass</li><li>Expert installation</li><li>Nationwide lifetime warranty</li><li></li><li>New {textLink:EstimateRearWiperModal,rear wiper blade}</li><li>{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment</li></ul>",
buttonAuxillaryCopy: "$410.20",
buttonFooterCopy: "",
},
},
"05_01_CSR_Quote_Windshield+SideGlass": {
tierOne: {
value: "TierOne",
buttonLabel: "Economy service",
buttonLabelSubCopy: "",
buttonBodyCopy:
"<ul><li>New replacement glass</li><li>Expert installation</li><li>Nationwide lifetime warranty</li></ul>",
buttonAuxillaryCopy: "$350.22",
buttonFooterCopy:
"New wiper blades are not included with Economy service. Because chips can disrupt the glass surface, we recommend new wipers after a repair.",
},
tierTwo: {
value: "TierTwo",
buttonLabel: "Standard service",
buttonLabelSubCopy: "MOST POPULAR",
buttonBodyCopy:
"<ul><li>New replacement glass</li><li>Expert installation</li><li>Nationwide lifetime warranty</li><li>New {textLink:EstimateFrontWiperModal,wiper blades}</li><li></li></ul>",
buttonAuxillaryCopy: "$435.90",
buttonFooterCopy: "",
},
tierThree: {
value: "TierThree",
buttonLabel: "Premium service",
buttonLabelSubCopy: "",
buttonBodyCopy:
"<ul><li>New replacement glass</li><li>Expert installation</li><li>Nationwide lifetime warranty</li><li>New {textLink:EstimateFrontWiperModal,wiper blades}</li><li></li><li>{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment</li></ul>",
buttonAuxillaryCopy: "$471.40",
buttonFooterCopy: "",
},
},
"05_01_CSR_Quote_SideGlass": {
tierOne: {
value: "TierOne",
buttonLabel: "Economy service",
buttonLabelSubCopy: "",
buttonBodyCopy:
"<ul><li>New replacement glass</li><li>Expert installation</li><li>Nationwide lifetime warranty</li></ul>",
buttonAuxillaryCopy: "$350.22",
buttonFooterCopy: "",
},
tierThree: {
value: "TierThree",
buttonLabel: "Premium service",
buttonLabelSubCopy: "",
buttonBodyCopy:
"<ul><li>New replacement glass</li><li>Expert installation</li><li>Nationwide lifetime warranty</li><li>New {textLink:EstimateFrontWiperModal,wiper blades}</li><li></li><li>{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment</li></ul>",
buttonAuxillaryCopy: "$471.40",
buttonFooterCopy: "",
},
},
"05_01_CSR_Quote_NoWiperFit": {
tierOne: {
value: "TierOne",
buttonLabel: "Economy service",
buttonLabelSubCopy: "",
buttonBodyCopy:
"<ul><li>New replacement windshield</li><li>Expert installation</li><li>Nationwide lifetime warranty</li></ul>",
buttonAuxillaryCopy: "$350.22",
buttonFooterCopy: "",
},
tierThree: {
value: "TierThree",
buttonLabel: "Premium service",
buttonLabelSubCopy: "",
buttonBodyCopy:
"<ul><li>New replacement windshield</li><li>Expert installation</li><li>Nationwide lifetime warranty</li><li></li><li></li><li>{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment</li></ul>",
buttonAuxillaryCopy: "$385.72",
buttonFooterCopy: "",
},
},
badCustomValue: {
tierOne: {
value: "TierOne",
buttonLabel: "Economy service",
buttonLabelSubCopy: "",
buttonBodyCopy:
"<ul><li>New replacement windshield</li><li>Expert installation</li><li>Nationwide lifetime warranty</li></ul>",
buttonAuxillaryCopy: "$350.22",
buttonFooterCopy: "",
},
tierThree: {
value: "TierThree",
buttonLabel: "Premium service",
buttonLabelSubCopy: "",
buttonBodyCopy:
"<ul><li>New replacement windshield</li><li>Expert installation</li><li>Nationwide lifetime warranty</li><li></li><li></li><li>{textLink:EstimateRainDefenseModal,Rain Defense}&trade; treatment</li></ul>",
buttonAuxillaryCopy: "$385.72",
buttonFooterCopy: "",
},
},
};

View file

@ -1,198 +1,112 @@
import {shallowMount, mount} from "@vue/test-utils"; import { shallowMount, mount } from "@vue/test-utils";
import servicePackageQuestion from "./service-package-question"; import servicePackageQuestion from "./service-package-question";
import { getMountOptions } from "@/helpers/unit-test-helper.js"; import { getMountOptions } from "@/helpers/unit-test-helper.js";
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import {
import {dispatch} from "@/store"; expectedModifiedAnswers,
import store from "@/store"; mockProcessedCmsContent,
import { mockCmsContent, expectedModifiedAnswers, mockProcessedCmsContent, inputQuestionWidgetAnswers } from "./service-package-question-test-helper" inputQuestionWidgetAnswers,
} from "./service-package-question-test-helper";
jest.mock("@/store", () => ({ jest.mock("@/store", () => ({
commit: jest.fn(), commit: jest.fn(),
dispatch: jest.fn(), dispatch: jest.fn(),
getters: {
order: {
damage: {
glassToReplace: [
{glassLocation: "Rear"}
]
},
},
hasAnyNonWindshieldGlassParts: true
},
// order: {
// damage: {
// isRepair: false
// }
// },
state: { // I think I can drop this when everything is done, but it's needed for generating the expected stuff from cms-content-helper
order: {
damage: {
isRepair: false,
},
glassToReplace: [
{glassLocation: "Rear"}
]
}
}
})); }));
// describe("service-package-question.vue", () => { describe("service-package-question.vue", () => {
// it("should emit captured value", () => { beforeEach(async () => {
// // Arrange
// const wrapper = setupMocks({});
// // Act
// wrapper.componentVM.selectedValues = "newValue";
// // Assert
// expect(wrapper.emitted()["update:modelValue"][0][0]).toEqual("newValue");
// });
// it("should return insurance answers from servicePackageAnswers when isInsuranceSelected = true", () => {
// // Arrange
// let modifiedProps = JSON.parse(JSON.stringify(mockProps)); // create a copy
// modifiedProps['isInsuranceSelected'] = true;
// const wrapper = setupMocks({props: modifiedProps});
// //Arrange
// expect(wrapper.vm.servicePackageAnswers[0].buttonLabel).toBe(mockCmsContent.insuranceGroupContentWidget.HeaderText);
// });
// it("should map cms content to a correctly customizied answers object", ()=> {
// // Arrange
// const expectedValue = mockCmsContent.cashAnswers.Answers[0].Name;
// // This round about way of referencing the mocked content mimics how it is referenced by the code
// // hopefully helpful for diagnosing why this test might be failing in the future
// const subWidgetName = mockCmsContent.cashAnswers.Answers[0].SubWidgetName;
// const cmsWidget = mockCmsContent[subWidgetName];
// const expectedButtonLabel = cmsWidget.HeaderText;
// const expectedButtonLabelSubCopy = cmsWidget.SubheaderText
// const expectedButtonBodyCopy = cmsWidget.BodyText;
// const expectedButtonAuxillaryCopy = "500.22"; // combined price of windshield + recal
// const expectedButtonFooterCopy = cmsWidget.FooterText;
// const wrapper = setupMocks({});
// // Assert
// const economyServicePackageAnswers = wrapper.vm.servicePackageAnswers[0];
// expect(economyServicePackageAnswers.value).toBe(expectedValue);
// expect(economyServicePackageAnswers.buttonLabel).toBe(expectedButtonLabel);
// expect(economyServicePackageAnswers.buttonLabelSubCopy).toBe(expectedButtonLabelSubCopy);
// expect(economyServicePackageAnswers.buttonBodyCopy).toBe(expectedButtonBodyCopy);
// expect(economyServicePackageAnswers.buttonAuxillaryCopy.includes(expectedButtonAuxillaryCopy)).toBe(true);
// expect(economyServicePackageAnswers.buttonFooterCopy).toBe(expectedButtonFooterCopy);
// });
// it("should not send a standard package answer if no VAPS are eligible for standard", () => {
// // Arrange
// let modifiedProps = JSON.parse(JSON.stringify(mockProps)); // create a copy
// modifiedProps['lineItems'].splice(1,3);
// const wrapper = setupMocks({props: modifiedProps});
// // Assert
// expect(wrapper.vm.servicePackageAnswers.length).toEqual(2);
// });
// it("should not send a standard package answer if no VAPS are eligible for standard", () => {
// // Arrange
// let modifiedProps = JSON.parse(JSON.stringify(mockProps)); // create a copy
// modifiedProps['lineItems'].splice(1,3);
// const wrapper = setupMocks({props: modifiedProps});
// // Assert
// expect(wrapper.vm.servicePackageAnswers.length).toEqual(2);
// });
// });
describe("service-package-question.vue, matching business rules for package display", () => {
// mock scenarios in figma:
// https://www.figma.com/file/Spt9hBtGj8r8PFFGNIN3G5/New-Funnel?node-id=100%3A11383
dispatch.mockImplementation(() => Promise.resolve({ data: mockCmsContent }));
beforeEach( async ()=> {
//processedCmsContent = await fetchCmsContentForPage('testPage');
//console.log(processedCmsContent);
processedCmsContent = inputQuestionWidgetAnswers; processedCmsContent = inputQuestionWidgetAnswers;
mockMixin = { mockMixin = {
methods: { methods: {
getCmsContent: jest.fn((widgetName, cmsFieldName) => { getCmsContent: jest.fn((widgetName, cmsFieldName) => {
return processedCmsContent[widgetName][cmsFieldName]; return processedCmsContent[widgetName][cmsFieldName];
}) }),
}, },
}; };
mockProps = { mockProps = {
'modelValue': 'initialValue', modelValue: "initialValue",
'isInsuranceSelected': false, isInsuranceSelected: false,
'insuranceCmsWidgetName': 'InsuranceServicePackageQuestionWidget', insuranceCmsWidgetName: "InsuranceServicePackageQuestionWidget",
'cashCmsWidgetName': 'CashServicePackageQuestionWidget', cashCmsWidgetName: "CashServicePackageQuestionWidget",
'availableLineItems': [ availableLineItems: [
{ {
partNumber : "001", partNumber: "001",
Description : "Windshield with Recal", Description: "Windshield with Recal",
partType : "Windshield", partType: "Windshield",
Quantity : "1", Quantity: "1",
BasePartNumber : "001", BasePartNumber: "001",
Color : "Green", Color: "Green",
CanSafeliteRecalibrate: true, CanSafeliteRecalibrate: true,
price : 350.22 price: 350.22,
}, },
{ {
"partNumber": "SBB16", partNumber: "RAIN DEFENSE",
"description": "SAFELITE BEAM BLADE 16", description: null,
"partType": "FRONT WIPER", partType: "RAIN DEFENSE",
"price": 32.64, price: 35.5,
}, },
{ ],
"partNumber": "SBB26",
"description": "SAFELITE BEAM BLADE 26",
"partType": "FRONT WIPER",
"price": 53.04,
},
{
"partNumber": "SBBR12A",
"description": "SAFELITE REAR BLADE 12A",
"partType": "REAR WIPER",
"price": 24.48,
},
{
"partNumber": "RAIN DEFENSE",
"description": null,
"partType": "RAIN DEFENSE",
"price": 35.50,
},
]
}; };
})
it("should match the 05_01_CSR_Quote_Standard_Repair mock", () => {
// Arrange
const packageNameKey = "05_01_CSR_Quote_Standard_Repair"; const packageNameKey = "05_01_CSR_Quote_Standard_Repair";
Object.assign(processedCmsContent, mockProcessedCmsContent[packageNameKey]); Object.assign(processedCmsContent, mockProcessedCmsContent[packageNameKey]);
});
it("should emit captured value", () => {
// Arrange
const wrapper = setupMocks({});
// Act
wrapper.componentVM.selectedValues = "newValue";
// Assert
expect(wrapper.emitted()["update:modelValue"][0][0]).toEqual("newValue");
});
it("should have the correct insurance pricing text when insurance is selected", () => {
// Arrange
mockProps.isInsuranceSelected = true;
const wrapper = setupMocks({});
// Act
// Assert
expect(
wrapper.vm.servicePackageAnswers[0].buttonAuxillaryCopy.includes("As little as")
).toBe(true);
});
it("should return [] from nullSafeAvailableLineItems and not error out if availableLineItems is null", () => {
// Arrange
mockProps.availableLineItems = null;
const wrapper = setupMocks({});
// Act
// Assert
expect(wrapper.vm.nullSafeAvailableLineItems).toEqual([]);
});
it("should return a null servicePackageAnswers if the cmsContent is falsy", () => {
// Arrange
mockMixin = {
methods: {
getCmsContent: jest.fn((widgetName, cmsFieldName) => {
return null;
}),
},
};
const wrapper = setupMocks({}); const wrapper = setupMocks({});
// Assert // Assert
// economy answer expect(wrapper.vm.servicePackageAnswers).toBe(null);
runPackageAnswerExpectStatements(wrapper.vm.servicePackageAnswers[0], expectedModifiedAnswers[packageNameKey].tierOne);
// standard answer
runPackageAnswerExpectStatements(wrapper.vm.servicePackageAnswers[1], expectedModifiedAnswers[packageNameKey].tierTwo);
// premium answer
runPackageAnswerExpectStatements(wrapper.vm.servicePackageAnswers[2], expectedModifiedAnswers[packageNameKey].tierThree);
}); });
it.only("should match the 05_01_CSR_Quote_Recal mock", () => { it("should treat an undefined 'getCustomValueFromString' as a false value and not error out", () => {
// Arrange // Arrange
const packageNameKey = "05_01_CSR_Quote_Recal"; const packageNameKey = "badCustomValue";
mockProps.availableLineItems.push(
{
partNumber : "RECAL STATIC",
Description : "Recalibration",
partType : "recalibration",
Quantity : "1",
price : 150.00,
},
);
Object.assign(processedCmsContent, mockProcessedCmsContent[packageNameKey]); Object.assign(processedCmsContent, mockProcessedCmsContent[packageNameKey]);
const wrapper = setupMocks({ const wrapper = setupMocks({
customMountOptions: { mountOptionsMockData: {
store: { store: {
getters: { getters: {
order: { order: {
damage: { damage: {
glassToReplace: [ isRepair: false,
{glassLocation: "Windshield"} glassToReplace: [{ glassLocation: "Windshield" }],
]
}, },
}, },
hasAnyNonWindshieldGlassParts: false hasAnyNonWindshieldGlassParts: false,
}, },
}, },
}, },
@ -200,26 +114,413 @@ describe("service-package-question.vue, matching business rules for package disp
// Assert // Assert
// economy answer // economy answer
runPackageAnswerExpectStatements(wrapper.vm.servicePackageAnswers[0], expectedModifiedAnswers[packageNameKey].tierOne); runPackageAnswerExpectStatements(
// standard answer wrapper.vm.servicePackageAnswers[0],
runPackageAnswerExpectStatements(wrapper.vm.servicePackageAnswers[1], expectedModifiedAnswers[packageNameKey].tierTwo); expectedModifiedAnswers[packageNameKey].tierOne
);
// standard answer should not be created
expect(wrapper.vm.servicePackageAnswers.length).toBe(2);
// premium answer // premium answer
runPackageAnswerExpectStatements(wrapper.vm.servicePackageAnswers[2], expectedModifiedAnswers[packageNameKey].tierThree); runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[1],
expectedModifiedAnswers[packageNameKey].tierThree
);
});
});
describe("service-package-question.vue, matching business rules for package display", () => {
// mock scenarios in figma:
// https://www.figma.com/file/Spt9hBtGj8r8PFFGNIN3G5/New-Funnel?node-id=100%3A11383
beforeEach(async () => {
processedCmsContent = inputQuestionWidgetAnswers;
mockMixin = {
methods: {
getCmsContent: jest.fn((widgetName, cmsFieldName) => {
return processedCmsContent[widgetName][cmsFieldName];
}),
},
};
mockProps = {
modelValue: "initialValue",
isInsuranceSelected: false,
insuranceCmsWidgetName: "InsuranceServicePackageQuestionWidget",
cashCmsWidgetName: "CashServicePackageQuestionWidget",
availableLineItems: [
{
partNumber: "001",
Description: "Windshield with Recal",
partType: "Windshield",
Quantity: "1",
BasePartNumber: "001",
Color: "Green",
CanSafeliteRecalibrate: true,
price: 350.22,
},
{
partNumber: "RAIN DEFENSE",
description: null,
partType: "RAIN DEFENSE",
price: 35.5,
},
],
};
});
it("should match the 05_01_CSR_Quote_Standard_Repair mock", () => {
// Arrange
const packageNameKey = "05_01_CSR_Quote_Standard_Repair";
Object.assign(processedCmsContent, mockProcessedCmsContent[packageNameKey]);
mockProps.availableLineItems.push(driverFrontWiperLineItem);
mockProps.availableLineItems.push(passengerFrontWiperLineItem);
const wrapper = setupMocks({
mountOptionsMockData: {
store: {
getters: {
order: {
damage: {
isRepair: true,
glassToReplace: [],
},
},
hasAnyNonWindshieldGlassParts: false,
},
},
},
});
// Assert
// economy answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[0],
expectedModifiedAnswers[packageNameKey].tierOne
);
// standard answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[1],
expectedModifiedAnswers[packageNameKey].tierTwo
);
// premium answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[2],
expectedModifiedAnswers[packageNameKey].tierThree
);
});
it("should match the 05_01_CSR_Quote_Recal mock", () => {
// Arrange
const packageNameKey = "05_01_CSR_Quote_Recal";
mockProps.availableLineItems.push(recalLineItem);
mockProps.availableLineItems.push(driverFrontWiperLineItem);
mockProps.availableLineItems.push(passengerFrontWiperLineItem);
Object.assign(processedCmsContent, mockProcessedCmsContent[packageNameKey]);
const wrapper = setupMocks({
mountOptionsMockData: {
store: {
getters: {
order: {
damage: {
isRepair: false,
glassToReplace: [{ glassLocation: "Windshield" }],
},
},
hasAnyNonWindshieldGlassParts: false,
},
},
},
});
// Assert
// economy answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[0],
expectedModifiedAnswers[packageNameKey].tierOne
);
// standard answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[1],
expectedModifiedAnswers[packageNameKey].tierTwo
);
// premium answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[2],
expectedModifiedAnswers[packageNameKey].tierThree
);
}); });
it("should match the 05_01_CSR_Quote_RearGlass mock", () => { it("should match the 05_01_CSR_Quote_RearGlass mock", () => {
// Arrange // Arrange
const packageNameKey = "05_01_CSR_Quote_RearGlass"; const packageNameKey = "05_01_CSR_Quote_RearGlass";
Object.assign(processedCmsContent, mockProcessedCmsContent[packageNameKey]); Object.assign(processedCmsContent, mockProcessedCmsContent[packageNameKey]);
const wrapper = setupMocks({}); mockProps.availableLineItems.push(driverFrontWiperLineItem);
mockProps.availableLineItems.push(passengerFrontWiperLineItem);
mockProps.availableLineItems.push(rearWiperLineItem);
const wrapper = setupMocks({
mountOptionsMockData: {
store: {
getters: {
order: {
damage: {
isRepair: false,
glassToReplace: [{ glassLocation: "Rear" }],
},
},
hasAnyNonWindshieldGlassParts: true,
},
},
},
});
// Assert
// economy answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[0],
expectedModifiedAnswers[packageNameKey].tierOne
);
// standard answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[1],
expectedModifiedAnswers[packageNameKey].tierTwo
);
// premium answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[2],
expectedModifiedAnswers[packageNameKey].tierThree
);
});
it("should match the 05_01_CSR_Quote_RearGlass+NonWindshield mock", () => {
// Arrange
const packageNameKey = "05_01_CSR_Quote_RearGlass+NonWindshield";
Object.assign(processedCmsContent, mockProcessedCmsContent[packageNameKey]);
mockProps.availableLineItems.push(driverFrontWiperLineItem);
mockProps.availableLineItems.push(passengerFrontWiperLineItem);
mockProps.availableLineItems.push(rearWiperLineItem);
const wrapper = setupMocks({
mountOptionsMockData: {
store: {
getters: {
order: {
damage: {
isRepair: false,
glassToReplace: [
{ glassLocation: "Rear" },
{ glassLocation: "Driver" },
],
},
},
hasAnyNonWindshieldGlassParts: true,
},
},
},
});
//console.log(wrapper.vm.servicePackageAnswers); //console.log(wrapper.vm.servicePackageAnswers);
// Assert // Assert
// economy answer // economy answer
runPackageAnswerExpectStatements(wrapper.vm.servicePackageAnswers[0], expectedModifiedAnswers[packageNameKey].tierOne); runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[0],
expectedModifiedAnswers[packageNameKey].tierOne
);
// standard answer // standard answer
runPackageAnswerExpectStatements(wrapper.vm.servicePackageAnswers[1], expectedModifiedAnswers[packageNameKey].tierTwo); runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[1],
expectedModifiedAnswers[packageNameKey].tierTwo
);
// premium answer // premium answer
runPackageAnswerExpectStatements(wrapper.vm.servicePackageAnswers[2], expectedModifiedAnswers[packageNameKey].tierThree); runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[2],
expectedModifiedAnswers[packageNameKey].tierThree
);
});
it("should match the 05_01_CSR_Quote_RearGlass+Windshield mock", () => {
// Arrange
const packageNameKey = "05_01_CSR_Quote_RearGlass+Windshield";
Object.assign(processedCmsContent, mockProcessedCmsContent[packageNameKey]);
mockProps.availableLineItems.push(driverFrontWiperLineItem);
mockProps.availableLineItems.push(passengerFrontWiperLineItem);
mockProps.availableLineItems.push(rearWiperLineItem);
const wrapper = setupMocks({
mountOptionsMockData: {
store: {
getters: {
order: {
damage: {
isRepair: false,
glassToReplace: [
{ glassLocation: "Rear" },
{ glassLocation: "Windshield" },
],
},
},
hasAnyNonWindshieldGlassParts: true,
},
},
},
});
// Assert
// economy answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[0],
expectedModifiedAnswers[packageNameKey].tierOne
);
// standard answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[1],
expectedModifiedAnswers[packageNameKey].tierTwo
);
// premium answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[2],
expectedModifiedAnswers[packageNameKey].tierThree
);
});
it("should match the 05_01_CSR_Quote_RearGlassNoFrontFit mock", () => {
// Arrange
const packageNameKey = "05_01_CSR_Quote_RearGlassNoFrontFit";
Object.assign(processedCmsContent, mockProcessedCmsContent[packageNameKey]);
mockProps.availableLineItems.push(rearWiperLineItem);
const wrapper = setupMocks({
mountOptionsMockData: {
store: {
getters: {
order: {
damage: {
isRepair: false,
glassToReplace: [{ glassLocation: "Rear" }],
},
},
hasAnyNonWindshieldGlassParts: true,
},
},
},
});
// Assert
// economy answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[0],
expectedModifiedAnswers[packageNameKey].tierOne
);
// standard answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[1],
expectedModifiedAnswers[packageNameKey].tierTwo
);
// premium answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[2],
expectedModifiedAnswers[packageNameKey].tierThree
);
});
it("should match the 05_01_CSR_Quote_Windshield+SideGlass mock", () => {
// Arrange
const packageNameKey = "05_01_CSR_Quote_Windshield+SideGlass";
Object.assign(processedCmsContent, mockProcessedCmsContent[packageNameKey]);
mockProps.availableLineItems.push(driverFrontWiperLineItem);
mockProps.availableLineItems.push(passengerFrontWiperLineItem);
mockProps.availableLineItems.push(rearWiperLineItem);
const wrapper = setupMocks({
mountOptionsMockData: {
store: {
getters: {
order: {
damage: {
isRepair: false,
glassToReplace: [
{ glassLocation: "Driver" },
{ glassLocation: "Windshield" },
],
},
},
hasAnyNonWindshieldGlassParts: true,
},
},
},
});
// Assert
// economy answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[0],
expectedModifiedAnswers[packageNameKey].tierOne
);
// standard answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[1],
expectedModifiedAnswers[packageNameKey].tierTwo
);
// premium answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[2],
expectedModifiedAnswers[packageNameKey].tierThree
);
});
it("should match the 05_01_CSR_Quote_SideGlass mock", () => {
// Arrange
const packageNameKey = "05_01_CSR_Quote_SideGlass";
Object.assign(processedCmsContent, mockProcessedCmsContent[packageNameKey]);
mockProps.availableLineItems.push(driverFrontWiperLineItem);
mockProps.availableLineItems.push(passengerFrontWiperLineItem);
mockProps.availableLineItems.push(rearWiperLineItem);
const wrapper = setupMocks({
mountOptionsMockData: {
store: {
getters: {
order: {
damage: {
isRepair: false,
glassToReplace: [{ glassLocation: "Driver" }],
},
},
hasAnyNonWindshieldGlassParts: true,
},
},
},
});
// Assert
// economy answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[0],
expectedModifiedAnswers[packageNameKey].tierOne
);
// standard answer should not be created
expect(wrapper.vm.servicePackageAnswers.length).toBe(2);
// premium answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[1],
expectedModifiedAnswers[packageNameKey].tierThree
);
});
it("should match the 05_01_CSR_Quote_NoWiperFit mock", () => {
// Arrange
const packageNameKey = "05_01_CSR_Quote_NoWiperFit";
Object.assign(processedCmsContent, mockProcessedCmsContent[packageNameKey]);
const wrapper = setupMocks({
mountOptionsMockData: {
store: {
getters: {
order: {
damage: {
isRepair: false,
glassToReplace: [{ glassLocation: "Windshield" }],
},
},
hasAnyNonWindshieldGlassParts: false,
},
},
},
});
// Assert
// economy answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[0],
expectedModifiedAnswers[packageNameKey].tierOne
);
// standard answer should not be created
expect(wrapper.vm.servicePackageAnswers.length).toBe(2);
// premium answer
runPackageAnswerExpectStatements(
wrapper.vm.servicePackageAnswers[1],
expectedModifiedAnswers[packageNameKey].tierThree
);
}); });
}); });
@ -230,26 +531,65 @@ function runPackageAnswerExpectStatements(servicePackageAnswer, expectedOutput)
expect(servicePackageAnswer.buttonFooterCopy).toBe(expectedOutput.buttonFooterCopy); expect(servicePackageAnswer.buttonFooterCopy).toBe(expectedOutput.buttonFooterCopy);
} }
function setupMocks({ customMountOptions, props = mockProps }) { function setupMocks({ mountOptionsMockData, props = mockProps }) {
const mountOptions = getMountOptions({ var mountOptionsMockDataDefault = {
...customMountOptions store: {
}); getters: {
console.log(mountOptions.global); order: {
damage: {
isRepair: false,
glassToReplace: [{ glassLocation: "Windshield" }],
},
},
hasAnyNonWindshieldGlassParts: false,
},
},
};
mountOptionsMockData = Object.assign(mountOptionsMockDataDefault, mountOptionsMockData);
const mountOptions = getMountOptions(mountOptionsMockData);
// Modify/augment default mount options // Modify/augment default mount options
mountOptions.global.mocks["$store"] = store;
mountOptions.global.mixins = [mockMixin]; mountOptions.global.mixins = [mockMixin];
mountOptions.propsData = props; mountOptions.propsData = props;
const wrapper = shallowMount(servicePackageQuestion, mountOptions); const wrapper = shallowMount(servicePackageQuestion, mountOptions);
return wrapper; return wrapper;
} }
/////////////// ///////////////
// Constants // // Constants //
/////////////// ///////////////
let processedCmsContent; let processedCmsContent;
let mockMixin; let mockMixin;
let mockProps; let mockProps;
let recalLineItem = {
partNumber: "RECAL STATIC",
Description: "Recalibration",
partType: "recalibration",
Quantity: "1",
price: 150.0,
};
let driverFrontWiperLineItem = {
partNumber: "SBB16",
description: "SAFELITE BEAM BLADE 16",
partType: "FRONT WIPER",
price: 32.64,
};
let passengerFrontWiperLineItem = {
partNumber: "SBB26",
description: "SAFELITE BEAM BLADE 26",
partType: "FRONT WIPER",
price: 53.04,
};
let rearWiperLineItem = {
partNumber: "SBBR12A",
description: "SAFELITE REAR BLADE 12A",
partType: "REAR WIPER",
price: 24.48,
};

View file

@ -15,7 +15,7 @@ describe("service-package-radio.vue", () => {
const outputHtml = wrapper.html(); const outputHtml = wrapper.html();
// Assert // Assert
expect(outputHtml).toEqual(expect.stringContaining(mockProps['buttonLabel'])); expect(outputHtml).toEqual(expect.stringContaining(mockProps["buttonLabel"]));
}); });
it("Should include buttonLabelAuxillaryCopy in html", async () => { it("Should include buttonLabelAuxillaryCopy in html", async () => {
@ -30,7 +30,7 @@ describe("service-package-radio.vue", () => {
const outputHtml = wrapper.html(); const outputHtml = wrapper.html();
// Assert // Assert
expect(outputHtml).toEqual(expect.stringContaining(mockProps['buttonLabelAuxillaryCopy'])); expect(outputHtml).toEqual(expect.stringContaining(mockProps["buttonLabelAuxillaryCopy"]));
}); });
it("Should include buttonLabelSubCopy in html", async () => { it("Should include buttonLabelSubCopy in html", async () => {
@ -45,7 +45,7 @@ describe("service-package-radio.vue", () => {
const outputHtml = wrapper.html(); const outputHtml = wrapper.html();
// Assert // Assert
expect(outputHtml).toEqual(expect.stringContaining(mockProps['buttonLabelSubCopy'])); expect(outputHtml).toEqual(expect.stringContaining(mockProps["buttonLabelSubCopy"]));
}); });
it("Should include buttonFooterCopy in html", async () => { it("Should include buttonFooterCopy in html", async () => {
// Arrange // Arrange
@ -59,7 +59,7 @@ describe("service-package-radio.vue", () => {
const outputHtml = wrapper.html(); const outputHtml = wrapper.html();
// Assert // Assert
expect(outputHtml).toEqual(expect.stringContaining(mockProps['buttonFooterCopy'])); expect(outputHtml).toEqual(expect.stringContaining(mockProps["buttonFooterCopy"]));
}); });
it("Should get 5 strings from getArrayOfListItemsFromRawCmsCopy when provided with a <ul><li>...</li>(x5)</ul> buttonBodyCopy", async () => { it("Should get 5 strings from getArrayOfListItemsFromRawCmsCopy when provided with a <ul><li>...</li>(x5)</ul> buttonBodyCopy", async () => {
// Arrange // Arrange
@ -81,21 +81,26 @@ describe("service-package-radio.vue", () => {
propsData: mockProps, propsData: mockProps,
}, },
}); });
// Act // Act
const results = wrapper.vm.getArrayOfListItemsFromRawCmsCopy(wrapper.vm.buttonBodyCopy); const results = wrapper.vm.getArrayOfListItemsFromRawCmsCopy(wrapper.vm.buttonBodyCopy);
// Assert // Assert
const fileredResults = results.filter(result => { const fileredResults = results.filter((result) => {
return result.includes("<ul>") || result.includes("</ul>") || result.includes("<li>") || result.includes("</li>") return (
}) result.includes("<ul>") ||
result.includes("</ul>") ||
result.includes("<li>") ||
result.includes("</li>")
);
});
expect(fileredResults.length).toBe(0); expect(fileredResults.length).toBe(0);
}); });
it("Should get 5 strings from getArrayOfListItemsFromRawCmsCopy when buttonBodyCopy has 6 total <li>...</li>, but one is empty ", async () => { it("Should get 5 strings from getArrayOfListItemsFromRawCmsCopy when buttonBodyCopy has 6 total <li>...</li>, but one is empty ", async () => {
// Arrange // Arrange
const moddedProps = mockProps; const moddedProps = mockProps;
moddedProps['buttonBodyCopy'] = "<ul><li>buttonBodyCopy test copy</li><li>2</li><li>3</li><li>4</li><li>5</li><li></li></ul>"; moddedProps["buttonBodyCopy"] =
"<ul><li>buttonBodyCopy test copy</li><li>2</li><li>3</li><li>4</li><li>5</li><li></li></ul>";
let { wrapper } = setupMocks({ let { wrapper } = setupMocks({
mountOptionsMockData: { mountOptionsMockData: {
propsData: moddedProps, propsData: moddedProps,
@ -114,9 +119,10 @@ const mockProps = {
buttonLabel: "buttonLabel test copy", buttonLabel: "buttonLabel test copy",
buttonLabelAuxillaryCopy: "buttonLabelAuxillaryCopy test copy", buttonLabelAuxillaryCopy: "buttonLabelAuxillaryCopy test copy",
buttonLabelSubCopy: "buttonLabelSubCopy test copy", buttonLabelSubCopy: "buttonLabelSubCopy test copy",
buttonBodyCopy: "<ul><li>buttonBodyCopy test copy</li><li>2</li><li>3</li><li>4</li><li>5</li></ul>", buttonBodyCopy:
buttonFooterCopy: "buttonFooterCopy test copy" "<ul><li>buttonBodyCopy test copy</li><li>2</li><li>3</li><li>4</li><li>5</li></ul>",
} buttonFooterCopy: "buttonFooterCopy test copy",
};
function setupMocks({ mountOptionsMockData = {} }) { function setupMocks({ mountOptionsMockData = {} }) {
const wrapper = mount(servicePackageRadio, { const wrapper = mount(servicePackageRadio, {