Updating tests

git push
This commit is contained in:
Michaela Brydon 2024-01-17 11:29:46 -05:00
parent deacd58008
commit 4b40e1ca6e

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