Merge branch 'develop' into feature/SSR-1089

This commit is contained in:
Katie Kroell 2024-01-17 15:49:49 -05:00
commit 65636a11ed
4 changed files with 54 additions and 10 deletions

View file

@ -248,13 +248,25 @@ describe('contactDetails.vue', () => {
expect(wrapper.vm.$router.navigateWithSpinner) expect(wrapper.vm.$router.navigateWithSpinner)
.toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK, undefined); .toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK, undefined);
}); });
test('Forward button clicked triggers navigation', () => { test('Forward button clicked triggers appropriate navigation when safelite shop', () => {
// Arrange // Arrange
const wrapper = shallowMount(contactDetails, getMountOptions({ const mountOptions = getMountOptions({
router: { router: {
navigate: jest.fn() navigate: jest.fn()
},
navigationScenarios
});
const mainInitialState = {
order: {
serviceLocation: { IsSafeliteProvider: true }
} }
})); };
mountOptions.global.plugins = [createTestingPinia({
initialState: {
main: mainInitialState
}
})];
const wrapper = shallowMount(contactDetails, mountOptions);
// Act // Act
wrapper.vm.forwardButtonAction(); wrapper.vm.forwardButtonAction();
@ -262,7 +274,35 @@ describe('contactDetails.vue', () => {
// Assert // Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
expect(wrapper.vm.$router.navigate) expect(wrapper.vm.$router.navigate)
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD, undefined); .toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE_SHOP, undefined);
});
test('Forward button clicked triggers appropriate navigation when TPA shop', () => {
// Arrange
const mountOptions = getMountOptions({
router: {
navigate: jest.fn()
},
navigationScenarios
});
const mainInitialState = {
order: {
serviceLocation: { IsSafeliteProvider: false }
}
};
mountOptions.global.plugins = [createTestingPinia({
initialState: {
main: mainInitialState
}
})];
const wrapper = shallowMount(contactDetails, mountOptions);
// Act
wrapper.vm.forwardButtonAction();
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
expect(wrapper.vm.$router.navigate)
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_NON_SAFELITE_SHOP, undefined);
}); });
test('Forward button click updates contact info', () => { test('Forward button click updates contact info', () => {
// Arrange // Arrange

View file

@ -196,10 +196,10 @@ export default {
notesForTechnician: this.notesForTechnician notesForTechnician: this.notesForTechnician
}; };
useMainStore().updateContactInfo(contactInfo); useMainStore().updateContactInfo(contactInfo);
this.$router.navigate( const scenario = useMainStore().order.serviceLocation.IsSafeliteProvider === false
this.navigationScenarios.CLICKED_FORWARD, ? this.navigationScenarios.CLICKED_FORWARD_WITH_NON_SAFELITE_SHOP
this.$route : this.navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE_SHOP;
); this.$router.navigate(scenario, this.$route);
} }
} }
}; };

View file

@ -208,7 +208,7 @@ export default {
return [this.companyName ?? '', displayAddress, displayPhoneNumber]; return [this.companyName ?? '', displayAddress, displayPhoneNumber];
}, },
getContactInfoLines() { getContactInfoLines() {
const { firstName, lastName, emailAddress, phoneNumber } = useMainStore().order.contactInfo; const { firstName, lastName, emailAddress, phoneNumber } = useMainStore().contactInfo;
return [ return [
`${firstName} ${lastName}`, `${firstName} ${lastName}`,
emailAddress ?? '', emailAddress ?? '',

View file

@ -581,8 +581,12 @@ const routingTable = () => [
destinationIssPageValue: issPageValues.SCHEDULE_PAGE destinationIssPageValue: issPageValues.SCHEDULE_PAGE
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD, scenario: navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE_SHOP,
destinationIssPageValue: issPageValues.SERVICE_PACKAGES destinationIssPageValue: issPageValues.SERVICE_PACKAGES
},
{
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NON_SAFELITE_SHOP,
destinationIssPageValue: issPageValues.TPA_SUBMIT
} }
] ]
}, },